Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

e.cancel is not a member of system.eventargs

Status
Not open for further replies.

honeypot

Technical User
Mar 6, 2001
147
GB
Hi there :)

I'm trying to display a message box on an exit event and have used the following code, but i get an error: e.cancel is not a member of system.eventargs. Could sum1 pls tell me where i'm going wrong. Thanx.

Private Sub mnuFileExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileExit.Click
'before closing make sure the data is pushed back to the database!
Me.Close()
If MessageBox.Show("Are you sure you want to exit?", "Exit", _
MessageBoxButtons.YesNo, MessageBoxIcon.Question) _
= DialogResult.No Then
e.cancel = True
End If
End Sub
 
Click cannot be canceled in the same way an update can be cancelled from BeforeUpdate. Click has already happen therefore cannot be cancelled.

Private Sub mnuFileExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileExit.Click
'before closing make sure the data is pushed back to the database!
If MessageBox.Show("Are you sure you want to exit?", "Exit", _
MessageBoxButtons.YesNo, MessageBoxIcon.Question) _
= DialogResult.No Then
Me.Close()
End If
End Sub

would work though.

Also.....

Using txt msgng whn typng iz vry annyng. Pls dont.....

Craig
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top