|
-
Apr 5th, 2010, 04:42 PM
#1
Thread Starter
New Member
On Form Unload
Hey,
I'm trying to add a MsgBox and a few other things when a user exists the program but I can't seem to find the event for the form.
I tried the "leave" form event but it's not working.
Any help?
What I tried and didn't work:
Code:
Private Sub Form1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Leave
MsgBox("Bye!")
End Sub
-
Apr 5th, 2010, 05:00 PM
#2
Re: On Form Unload
did you tried the FormClosing event ?
Code:
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
MessageBox.Show("Bye")
End Sub
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
Apr 5th, 2010, 05:00 PM
#3
Hyperactive Member
Re: On Form Unload
Try putting your code in the FormClosing event.
Remember to click on the scales to the left and rep me if I helped 
-
Apr 5th, 2010, 05:27 PM
#4
Frenzied Member
Re: On Form Unload
You must have it in the FormClosing event not in Form1_Leave.
motil example would be correct and so as The Fire Snake.
-
Apr 5th, 2010, 07:44 PM
#5
Thread Starter
New Member
-
Apr 6th, 2010, 12:59 AM
#6
Re: On Form Unload
It's a small thing but it would actually be more appropriate to use the FormClosed event. The FormClosing event is raised before the form closes and is generally used to stop the form closing under certain circumstances. The FormClosed event is raised after the form is closed.
That said, it would be more appropriate still to use the Shutdown event of the application itself and not use any event of the form.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|