when close button is pressed, stop program from ending?

Getox

Centurion
Joined
Jul 8, 2004
Messages
122
when close button is pressed, stop program from ending?
how do i do that with the tray icon still showing?
 
Last edited:
Getox said:
when close button is pressed, stop program from ending?
how do i do that with the tray icon still showing?
Visual Basic:
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        e.Cancel = True
    End Sub
Using the Cancel = true, stops the program from ending, after that you want to add any code for the systemtray icon. I believe you'll want to look at NotifyIcon class.

-Sean
 
Just a note, remember that adding e.Cancel = true, although prevents the application from being closed, remember you to take into account when you application is running and a user shuts down their computer, because this will halt the shutdown process.
 
Back
Top