tags:

views:

382

answers:

1

Hello everyone!

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.

+1  A: 

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).

CFP.

CFP