Multiple Forms
Here is the code for an example program that looks like this:

You can create multiple windows and easily move between them, hiding and showing each window.
|
|
Download the code by clicking on the Zip file. |
Public Class Form1
Inherits System.Windows.Forms.Form
' be careful, if you hide all of the
windows, your program will still be running with no visible windows
' you'll have to click the stop button to end the program
Private Sub Button2_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button2.Click
' hide the
current form
Me.Hide()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
' create an
instance of form2
Dim f2 As New Form2
' show form 2
f2.Show()
' store a
reference to the main form so we can show/hide it from form2
f2.f1 = Me
End Sub
End Class
Public Class Form2
Inherits System.Windows.Forms.Form
' create a variable to save a reference
to the main form (form1)
Public f1 As Form1
Private Sub Button2_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button2.Click
' hide the current
form
Me.Hide()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
' show form 1
f1.Show()
End Sub
End Class