private void button1_Click(object sender, EventArgs e)
bool IsOpen = false;
foreach (Form f in Application.OpenForms)
if (f.Text == "Form2")
IsOpen = true;
if (IsOpen == false)
Form2 f2 = new Form2();
f2.MdiParent = this;
Hi Kirtan,Thanks for putting the code snippet here. It saved me some time on researching.But I feel, using the name property of form instead of text is a a better solution.E.g.if (f.Text == "Form2") --> if (f.Name == "Form2")Thanks again. :)
if (f.Text == "Form2") --> if (f.Name == "Form2")Thanks again. :)
He completed his Bachelor of Computer Application from Gujarat University 2009 .He is doing Master of Computer Application from Gujarat Technological University right now ..
His area of Interests are Web Hacking , C# .n... Read more
C# Corner. All contents are copyright of their authors.