red man

red man

  • NA
  • 14
  • 0

form.close() is not working

Feb 7 2007 8:27 PM
Hi, I am using visual studio team suite 2005 for developing a windows app in C# I have 2 forms Form1 and Form2 I have a button control on Form1 called Bttn. In the click event of the button i am writing the following code so that i close the current Form i.e. Form1 and want to show Form2. MY code:: Form1 f = new Form1(); f.Close(); Form2 r = new Form2(); r.Visible = true; but with this i have 2 problems 1) Form1 is not closed and Form2 is open i.e. both forms are opened (f.close() is not working) 2) After running the app, when i close Form1 Strangely Form2 is also closed. but however if i close Form2 only that form2 is closed as expected. I am not implementing any mdi forms concept. Any help is appreciated thanks red

Answers (1)