2

I'm posting this here since it took a lot of time for me to understand how the whole thing works when trying to hide a form in the systray.

My question basically was: How can I hide a windows form running operations to the system tray?

CFP.

Clément
  • 12,299
  • 15
  • 75
  • 115

1 Answers1

1

The first step is to show the from that you will need to hide. Make sure you don't make it Modal.

Dim F as New MyForm
Form.Show()

Then, create a notification icon, and make associate the following with its click function:

Me.Visible = Not Me.Visible

Careful though. If you first showed the form using ShowDialog, then setting Visible = False will close the form and destroy it (which can get nasty if you were using a separate thread which communicated with the form, for example).

GEOCHET
  • 21,119
  • 15
  • 74
  • 98
Clément
  • 12,299
  • 15
  • 75
  • 115