Closing form & application

  • Thread starter Thread starter Alessandro
  • Start date Start date
A

Alessandro

How can i close the application when user click on X icon on top form ?
Otherwise application is only hidden.....
 
The whole concept of PPC is that apps don't get closed - memory
managment automatically closes programs when memory gets too low.
However, as part of the 'Made of Pocket PC' standard tests, developers
are allowed to handle the CTRL-Q shortcut to kill apps - but there
should be no direct method of cloing your program down.
eVB actually handled this quite well. Unfortunately, the CF doesn't,
and I can't point you in the direction on how, because I don't know.
Perhaps others here may be able to?
 
Hello, Paul and Alessandro

Closing an application in the .NET CF is actually pretty
easy, though as Paul mentioned, it will not be PPC logo
compliant.

As Neil stated in his message, you need to set the
MinimizeBox of your form to false. Then, to handle things
when the OK button is tapped, you will need to override
the OnClosingt even of the form.

ex: (VB)

Protected Overrides Sub OnClosing(ByVal e As
System.ComponentModel.CancelEventsArgs)
Dim result As System.Windows.Forms.DialogResult
MessageBox.Show("Exit Application?", "Exit",
MessageBoxButtons.YesNo, MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2)
If result = DialogResult.Yes Then
' Handle shutdown operations
End If
End Sub

C# code would be similar.

Hope that helps

Flynn
 
Back
Top