Reputation:
Sorry if such a question like this has been posted before. How do I make my VB application run in background so that I can click on the hidden icons in the tray of hidden icons (near the clock and the date) of my Windows 7 PC and re-activate it?
I tried to hide my form to do this, but I did not know how to re-activate its window back. On the OnClick()
method of my button cmdRunBG
, I typed:
Me.visible = false
Well, that thing just hid the form. I want it to really run in the background, having an icon in the tray of icons (near the system clock). How do I do that?
If you have any clarifications regarding this, please respond.
Thanks.
Upvotes: 1
Views: 6417
Reputation: 2123
What you really want is to programmatically minimize your form. Try that:
Me.WindowState = FormWindowState.Minimized
EDIT:
If you want to put the application on system tray, a simple way to do it is the following:
add the following code in the Resize
event of your form:
If Me.WindowState = FormWindowState.Minimized Then
Me.Hide()
End If
add the following code in the MouseClick
event of your NotifyIcon:
If Me.WindowState = FormWindowState.Minimized Then
Me.Show()
Me.WindowState = FormWindowState.Normal
End If
Upvotes: 1