How to show a form?

Use the example hog gave you. Forms in .NET are classes, so you must use them as such. To use a class you must first instantiate it (you know, with the new keyword).

Code:
Dim frm As New form1()
frm.Show()
 
After the following code required to write set frm = Nothing for release the memory?
Thanks :)

Dim frm As New form1()
frm.Show()
 
You only need to call Dispose if you showed the form using ShowDialog. If you just used form.Show(), you dont have to call Dispose().

-Nerseus
 
Notify Icon

anyone run into a problem with a tray icon loading several times using the above method?

Dim frmMain as new FormMain()
frmMain.show()


If you have a tray icon (Notify Icon) loading with your Main form and switch from a second form back to the form using the Notify Icon, it loads another icon into the tray each time.
 
Nerseus, hows that, that you dont need to call the dispose method when you use the show, only when you use the ShowDialog method??? This means that in my app Ive beed doing things wrong????, why in every place around the internet they say that if you want to unload, close the form you need to call the dispose method the gice the GC chance to clean up the memory???
 
Back
Top