I want to be able to minimize my VB.Net program to a task tray icon (clicking on the icon will then show it again) however in .Net VB as soon as you hide or set visible = false (or even take away the borders, make it size 0,0 and showintaskbar to false), it closes and the program ends.

I run the program from Sub Main, which initalises the program and then just does a form.showdialog.

The form has a NotifyIcon which I can get to display before I show the form, however as soon as I attempt to 'hide' the form by any means it closes it (and the notifyicon) and returns to Sub Main which then closes the application.

This was not a problem in VB 6 as you could manually load and unload forms.

Does anyone know how I can get around this problem in VB .Net???

Thanks in advance.