Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Close form after open another

this.Hide(); dont work
this.close(); close app, not open another form

What I miss?

What I have tried:

Form1 frm = new Form1();
            frm.Show();
            this.Close();
Posted
Updated 25-Apr-18 10:23am
Comments
BillWoodruff 26-Apr-18 0:27am    
"this.Hide(); dont work" what do you mean ? doesn;t the Form get hidden ?
Goran Bibic 26-Apr-18 1:40am    
I want to close this Form0...not hide Form0, becose when I close another Form1, Form0 stay opened
GenJerDan 26-Apr-18 2:22am    
If the form you're trying to close is the "main" form of the application, closing it will close the application itself. You're better off hiding it (you can close other forms, if there will be more following this pattern), or trying doing the whole thing differently. Have to you looked at any examples of "wizards"? Wizards do something close to what you seem to be wanting to do.

1 solution

As the form 1 is child and your are trying to close the parent form which is not possible for you can use

this.Hide();
Form1 frm = new Form1();
frm.Show();
 
Share this answer
 
Comments
Goran Bibic 26-Apr-18 1:38am    
I want to close this Form0...not hide Form0, becose when I close another Form1, Form0 stay opened

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900