In VB6 if you wanted to unload form1 and then load form2, the code would be:
Sub Button_Click
Form1.Visible = False
Unload Form1
Load Form2
Form2.Visible = Ture
End Sub
How is this done in VB.NET?
Thanks.
There are several ways to accomplish this, it depends on exactly what
you want to do. Typically, you would unload a form in VB6 if you
didn't need to show it anymore.
In .NET a form is loaded when you invoke the Show or ShowDialog
method. It is unloaded when you invoke the Close method. But you can
leave the form loaded but make it not visible by either setting the
Visible property to false or the Opacity property to 0.
The Show method shows the form non-modal. SHowDialog shows it modally.
Typically, when a form is shown with the ShowDialog, the form is
closed by invoking the Close method itself. If shown non-modally, then
the thread that Showed it typically Closes it.