954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Close a form without exit the program

Hey guys! I've been working on two projects, one needs to have multiple forms, but when I open one form, it needs to close the sender.

But, when I try it, the program exits! I don't want it, I just want to close the form, not the app.

I tried the 'Form1.Hide()' too, but it doesn't sound good to me. There is other approach?

Thanks!

RenanLazarotto
Posting Whiz in Training
247 posts since Nov 2010
Reputation Points: 16
Solved Threads: 10
 
me.dispose(false)
Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

>There is other approach?
In your project's Properties/Application tab, locate the "Shutdown Mode:" and set it for "When last form closes".

codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
 

I tried both ways, and both had the same result.

Setting the 'Dispose(false)' made the program to continue running after I closed all forms. Same as setting the shutdown mode. When I opened the new form and closed it, the program kept running. What am I doing wrong?

RenanLazarotto
Posting Whiz in Training
247 posts since Nov 2010
Reputation Points: 16
Solved Threads: 10
 

Use Application.Exit() to exit your application whenever needed.

codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
 

Thank you, now it is working (:

RenanLazarotto
Posting Whiz in Training
247 posts since Nov 2010
Reputation Points: 16
Solved Threads: 10
 
Thank you, now it is working (:


Hi RenanLazarotto, what do you do to when you close form but with-out lost data.

maytinh07
Newbie Poster
4 posts since Oct 2011
Reputation Points: 10
Solved Threads: 0
 

>>Hi RenanLazarotto, what do you do to when you close form but with-out lost data.
Use Me.Hide and Not Me.Close .

codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You