I am new to Windows Mobile and created an app that needs to do some clean up when a Form is closed. When I click on the Close in the ControlBox it does not call the OnClosing event. This works fine in regular windows but is not working with my Windows Mobile device.
Here is my code:
protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { ... }
I have also tried this with no luck:
Form.Closing += new System.ComponentModel.CancelEventHandler(WindBaseForm_Closing);
I would appreciate any help you can give.
Correct. The (X) button in Windows Mobile is called the ‘Smart Minimize’ button and only minimizes the Form. Set the Form’s MinimizeBox property to false and it will change to (OK) which will close the Form (and raise the event).
For the gory details as to why this happens, read this.