I'd like to do something when a user presses the X in the top right corner. How?
I work in VB.net
Thx
I work in VB.net
Thx
Private Sub Form2_FormClosing(ByVal sender As System.Object,_ ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing If e.CloseReason = CloseReason.TaskManagerClosing_ Or e.CloseReason = CloseReason.WindowsShutDown Then 'If either of these are true, 'you want your app to shut down immediately. e.Cancel = False Else 'Do what you need to do here. MessageBox.Show("Can't Close") 'if you want the closing to be canceled, set true, else false. e.Cancel = True End If End Sub
Comment