Hi Guys!

I wanna ask questions about the code

Me.hide

I have a button to switch between two forms, and I used the me.hide code to perform the action.
However When I exit the program, the debug is still on, meaning that the form which I hide is still running.
But if I use the code

Me.close

the whole program closes down.
Is there a way to close down a form and a new form is shown up, and be able to switch back the first form and stop the debugging process after exiting?

Thank you!

Recommended Answers

All 2 Replies

Just adding my 2 cents worth.

In the File Menu, Project/Properties, Application Tab, you can locate the Shutdown Mode: Options which allow you to Shutdown the application "When startup form closes" or "When last form closes".

Selecting when last form closes, always show the other form first, then close the current one. example:

Form2.Show()
        Me.Close()

Closing a Form, the current data set on the Form will be reset to the original data of the Form. For example, having a Textbox on Form1 and using the above code, if you had text typed into the Textbox, the text will be lost.

In the case that you want to keep the data as is on a Form, use the .Hide() option.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.