0

I've been looking around the internet and I haven't really found any solution to my problem. Is there a way to perform a function when a user closes the form either by pressing the X button in the top right hand corner? I am using a database that saves what form the user is currently looking at, and when the application is closed I want to say "offline."

Any assistance would be appreciated!

3
Contributors
4
Replies
6
Views
6 Years
Discussion Span
Last Post by maggoteer
1

Use FormClosed when you want to execute something when the form is closed.

Private Sub Form1_FormClosed(sender As Object, e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
     ''Your code here
End Sub

Use the following code FormClosing if you want to execute something right before the form close.

Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
     ''Your code here
End Sub

Edited by bluehangook629: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.