The main difference is that you have to set a variable to the form, and then access the forms properties through that variable. The form can also be hidden in VB .NET, but I'm not sure if you want to hide it, or close it. Closing it will give you back resources. Hiding keeps the resources in use and the form still loaded in memory and accessible through code. If you're not going to use the form anytime soon or it's a one shot, best close it. If you're going to keep using it but don't want it visible all the time then hide would probably be better so you're not constantly opening and closing it.
The above code could be written like this:
VB Code:
Dim myForm as new Form2 Private Sub Command1_Click() myForm.ShowDialog End Sub
VB Code:
Private Sub Command2_Click() myForm.close ' or myForm.hide End Sub




Reply With Quote