E
enrico via DotNetMonster.com
i created an exitstrip tool on my system and i want my system to ask the user
if he/she really wants to exit the application. but when i add a command on
the forms close button my exitstrip tool doesn't work well. this is my
command on my exitstrip tool:
Private Sub ExitToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles ExitToolStripMenuItem1.Click
Flag = True
If MessageBox.Show("Do you really want to exit this application?", "",
MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
Me.Close()
Else
TextBox3.Focus()
End If
End Sub
and this is my command on my close button:
Private Sub Form3_FormClosing(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
If MessageBox.Show("Do you really want to exit this application?", "",
MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.No Then
e.Cancel = True
End If
End Sub
is there something wrong on my codes?
if he/she really wants to exit the application. but when i add a command on
the forms close button my exitstrip tool doesn't work well. this is my
command on my exitstrip tool:
Private Sub ExitToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles ExitToolStripMenuItem1.Click
Flag = True
If MessageBox.Show("Do you really want to exit this application?", "",
MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
Me.Close()
Else
TextBox3.Focus()
End If
End Sub
and this is my command on my close button:
Private Sub Form3_FormClosing(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
If MessageBox.Show("Do you really want to exit this application?", "",
MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.No Then
e.Cancel = True
End If
End Sub
is there something wrong on my codes?