The construct seemed straightforward to begin with, but . . .
So when the user exits the application, then that is the time to write to a preferences file or do some cleanups etc. Pretty basic stuff I thought.
It’s easy enough to determine if changes have been made, but I can’t work out how to go back, or resume if the user chooses CANCEL. The program exits anyway without my control.
This all happens in the Main Window, Close Event:
Dim result as Integer Dim myMessage As String = "Do you want to Save the changes made in the SPECIFICATIONS panel?" result = MsgBox (myMessage,51,"Impulse Recorder") If result = 6 Then //YES Pressed HeaderFileWRITE // Write changes to Header Data File End If If result = 7 Then //NO Pressed // Do nothing and exit without saving changes End If If result = 2 Then //CANCEL Pressed Return // Return to the program and do nothing End If
Intuitively I think it’s something to do the the “close” event - but I cannot see an alternative.
Help appreciated. Cheers.