I have two windows forms.Now I have to close first one and show the second form and vice-versa.How can i do it.I was passing this pointer to the constructor of second form and then trying to
close it,but this did not work.I can not use showdialog here.
I have two windows forms.Now I have to close first one and show the
Share
Add static variables to each form in the Program class:
Then in the Form_Closing event of each form:
(Change
Program.f2.Show()toProgram.f1.Show()in Form2).Of course this will stop the application from ever closing, so you should provide an extra button (or similar) that sets a boolean static variable (FullClose) that the Form_Closing events can check to see if they should properly close or not.