In C#, I used to capture the application exit event with the following code in program.cs.
static void OnProcessExit(object sender, EventArgs e)
{
string message = "The application was closed at :" + DateTime.Now.ToString() + ".";
}
What is the equivalent of this in VB.NET?
I want to close the database connection if it is open by any chance in the application exit event.