I want to save some data when a form is closed or the application terminates. I put a call to my save data method inside the close event sub yet it doesnt seem to get executed when I call application.exit.
Printable View
I want to save some data when a form is closed or the application terminates. I put a call to my save data method inside the close event sub yet it doesnt seem to get executed when I call application.exit.
Could you show us your code please :)
Which event do you have your code in?
Did you try putting a message box in the exit area to test if it gets displayed, or do a step by step code process by pressing f8?
vb Code:
Private Sub FormName_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing Msgbox "I'm still open" End Sub
I figured my error. Was using the old close method which does not get raised by the Application.Exit. The FormClosing method new to 2005 gets raised by Application.Exit
Yeah, I had that same problem when I migrated from VB6. I was like, why are none of my files being updated at closing. hehe.