views:

34

answers:

2

Hello, i am new to C#, i have an issue. that is i have some n forms in my Windows Mobile App. if i press at "X-out"(Top-Right corner), the total app is getting closed. now i need to change that "X" symbol as "OK", and if i press at "OK", only the current form should be closed and the form which calls this form should resume.

thanks for helping on this issue.

+4  A: 

You should handle the Form.OnClosing event.

That will give you a chance to do other work and then cancel the application close.

Justin Niessner
i got it to code on form.OnClosing. but i was unable to know how to do it.can you please provide some code Snippet with an example.
raj
A: 

I don't understand exactly what you're doing or wanting. In Windows Mobile, if you click the (X) in the upper corner of the form, unlike the desktop, it minimizes the Form. This will not shut down your application, nor will it fire any Closing-related events.

If you change the Form properties to have MinimizeButton = true, then the (X) changes to an (OK) and it will actually close the Form.

In either case, when it happens, the calling Form (if there is one) will come to the fore (unless it was also hidden). We need to better understand exactly what you are doing (code would help there) and what, exactly, you are trying to achieve.

ctacke