Me.Hide() 'this form is no longer required
Form1.Show() 'switch to main form
End Sub
This will switch to the other (main) form where you will run your main application. Note that if you use the Me.close event then the form will close but the application will still be running.
Select form 1 code window and add ALL of this code at the top of the code page under the Public Class Form 1 heading. Do not click on the form to open the window as this creates a code segment called Form Load.
Private Sub Form1_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
End 'closing Form1 is the end of the application
End Sub
Now when you click on your close / end button on Form 1 the whole application will close.
The last step before testing is to change your start up form to Form2. Locate your solution explorer on the right hand side of the screen, and note at the top is the title of your project. Right mouse click and select properties. Change the start up form to Form2 then close the window.
Save and test your project.