I understand the form closing event.
But I want to detect when my app. is closing. It needs to update a status into the database, and only when the app. is closing. I have multiple forms in my application and people can close a app with the X or with a nice button. Therefore if I use the form closing event, I need to write the code on every form, because a user can close the app from every form in this app if he wanted to. Then I need to detect if all forms are closed before updating the status.
This status in the databse may only be updated when the app is closing (exit), not when a particular form is leaving or closed.
This have to do with a login status. When you log in with a particular account, a status is set into the database. When logging out, the status is updated. This prevents that not 2 people can log in with the same account. After leaving (logging out) the status is updated and somebody else can use this account.
The best thing tot do that is to detect if a user exits the application.
Many thanx for your help!