Pocket PC: How to stop a form from closing
75 pts.
0
Q:
Pocket PC: How to stop a form from closing
Using C#, on a WinForm, to stop a form from closing, I simply have to put this line in the public Form1(): this.Closing += new System.ComponentModel.CancelEventHandler(this.Form1_Closing);

and add this bit:
public void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (MessageBox.Show("Are you sure you want to exit?", "Confirm exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No)
{
e.Cancel = true;
}

However, on a Smart Device (I am using WM5) it doesn't run. Any ideas?
ASKED: Jul 28 2009  9:45 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
75 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
Last Answered: Jul 28 2009  9:45 PM GMT by TJay   75 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

TJay   75 pts.  |   Jul 29 2009  12:34PM GMT

I figured it out.. The problem is that the X button on a WM form acts as a “Smart Minimize” and does not actually close. Setting the MinimizeBox = False fixes it…

 
0