Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

What is the proper way to exit a CE .Net Compact Framework application?

Posted on 2006-04-19
5
Medium Priority
?
1,298 Views
Last Modified: 2008-01-16
I am trying to write a simple CE program in C#, using the .Net Compact Framework. The first thing this app does is open a login dialog box.  This dialog box also has an "Exit" button on it.  If the user hits the exit button, I simply want to exit.  I wrote the code this way:

     LogonDialog ld = new LogonDialog(cfgFN);
      DialogResult dr = ld.ShowDialog();
      if (dr == DialogResult.Cancel)
      {
          this.Close();
      }
      else
      {
                       .................
     }

When I execute the above code so and the user hits the Exit button, the app exits, but I get an ObjectDisposedException before it actually exits.  If I chang:

            this.Close();
to

             System.Windows.Forms.Application.Exit();
             return;

the app will return without this error.  But this code just doesn't look right to me.  What is the proper way to exit from a CE .Net application?  Are either of the above correct?

Thanks!
0
Comment
Question by:mromeo
  • 3
  • 2
5 Comments
 
LVL 12

Expert Comment

by:topdog770
ID: 16490126
That's the approach my several CE applications have taken.

Application.Exit();
0
 

Author Comment

by:mromeo
ID: 16490635

Do you know if this is the proper way to do this?  
0
 
LVL 12

Accepted Solution

by:
topdog770 earned 1000 total points
ID: 16492144
Generally speaking, yes.

Here's a pretty good summary

http://geekswithblogs.net/mtreadwell/archive/2004/06/06/6123.aspx
0
 

Author Comment

by:mromeo
ID: 16492176
Great post! Thanks.  
0
 
LVL 12

Expert Comment

by:topdog770
ID: 16493032
You're welcome!  It's always nice to be able to help.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month21 days, 7 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question