To show a form you can use the Show method. This will automatically load the form into the memory (if not already loaded), and then display the form. The following statement displays Form1:
Form1.Show
You might want to show a form, and stop all code until it has been closed. You would use this for an options dialog for example. The following code displays Options1, and then displays a message box after it has been closed
Options1.Show vbModal
Msgbox "Options1 Closed"
To see how this differs from normal, remove the text vbModal.
Sometimes, you will want to load the form into the memory, but not show it straight away. This would be the case if you wanted to load your main form while displaying a splash form. To do this you can use the Load method. Load takes the following form:
Load Form
The following code shows Splash1 (the splash form), then loads Main1 (the main form), then removes Splash1 from the memory (see Hiding Forms) and displays Main1.
' Show the splash form
Splash1.Show
' Load the main form
Load Main1
' Unload the Splash form
Unload Splash1
' Show the main form
Main1.Show
Comments