help, can't make send-to-tray work

shawne

Well-known member
Joined
Feb 22, 2006
Messages
103
Location
Pennsylvania
Programming Experience
10+
Ok, when I click my button to minimize to tray, the notify icon shows up, the form minimizes to the system tray and hides, then the application ends....Here is the snippet that is suppose to in affect minimize to the system tray:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.WindowState = FormWindowState.Minimized
Me.ShowInTaskbar = False
NotifyIcon1.Visible = True
End Sub

This should be a simple thing, but I can't figure it out.
 
There's nothing wrong with that code, except that you should probably set the form's Visible property to False to hide it from Alt+Tab. There must be something else at work. Create a Closing event handler for your form and put a break point on it. If the break point is hit then use the Call Stack window to trace where it originated from. If the break point is not hit then either you're calling Application.Exit somewhere or you are suffering a serious crash. If you're calling Application.Exit then that should be easy to find. If the app is crashing without giving you any information then that would most likely be a corruption in your IDE or Framework I would think.
 
Back
Top