I have a Menustrip With 1 Menu Item Say Add Record.
When i click on Add Record Menu Item assume Form1 is opened.
My Problem is When i click on Add Record for 5 Times. it is opening Form1 5 Times.
How to open Form1 Once only even though i clicked for N Times.
Its the MDI form
Thanks in Advance..
Loading
Sam HobbsPosted Jun 13, 2011, 5:25 PM
VulpesPosted Jun 13, 2011, 8:49 AM
If it's an MDI child, then it's not included in the Application.OpenForms collection and you'll have to do something like this instead:
Sam HobbsPosted Jun 13, 2011, 8:41 AM
Dorababu MekaPosted Jun 13, 2011, 8:12 AM
bool IsOpen = false;
foreach (Form f in Application.OpenForms)
{
if (f.Text == "Form2")
{
IsOpen = true;
f.Focus();
break;
}
}
if (IsOpen == false)
{
Form2 f2 = new Form2();
f2.Show();
}
Check this article http://www.c-sharpcorner.com/UploadFile/kirtan007/819/
Veeramanikandan DhanabalanPosted Jun 13, 2011, 8:05 AM
No.. not working....
VulpesPosted Jun 13, 2011, 7:27 AM