Problems closing forms
-
HI all, I am pretty new to the whole C# and Visual Studio scene and I am having a problem with closing my forms. I have a main form open, then after clicking a button (ie search) I pop-up another window. When I have finished with the window the user must close it, but everytime you click it it will close both the window and the main form instead of just the window. I have tried: - this.Close(); - this.Close(frmSearch); - Form.ActiveForm.Close(); But to no avail. Any help would be great! Cheers Guys Carnal (Car-Lan) Car and Computer Club http://carnalonline.org.
-
HI all, I am pretty new to the whole C# and Visual Studio scene and I am having a problem with closing my forms. I have a main form open, then after clicking a button (ie search) I pop-up another window. When I have finished with the window the user must close it, but everytime you click it it will close both the window and the main form instead of just the window. I have tried: - this.Close(); - this.Close(frmSearch); - Form.ActiveForm.Close(); But to no avail. Any help would be great! Cheers Guys Carnal (Car-Lan) Car and Computer Club http://carnalonline.org.
I preassume that you create instance of form when you click button(search). FormSearch search = new FormSearch(); search.show(); to close this you can use search.Close(); This will close only search form. And if the close button is on search form itself, you should be able to use this.Close(); :):) - ashish
-
I preassume that you create instance of form when you click button(search). FormSearch search = new FormSearch(); search.show(); to close this you can use search.Close(); This will close only search form. And if the close button is on search form itself, you should be able to use this.Close(); :):) - ashish
-
Thanks for the reply but that doesnt seem to work. It closes the form but still closes the whole system.... I am totally out of ideas! If anyone can help that would be great!