The ability to load forms once, is something essential in many applications. But, this is a simple way to do that:
public Boolean IsFormAlreadyLoaded(string formToLoadName)
{ //Allow only one instance of any MDI child form in your MDI application
foreach (Form frmChild in this.MdiChildren)
{ if (frmChild.Name == formToLoadName)
{
frmChild.Activate();
return true;
}
}
return false;
}
public Boolean IsFormAlreadyLoaded(string formToLoadName)
{ //Allow only one instance of any MDI child form in your MDI application
foreach (Form frmChild in this.MdiChildren)
{ if (frmChild.Name == formToLoadName)
{
frmChild.Activate();
return true;
}
}
return false;
}
No comments:
Post a Comment