Howto Change application's main form

Hi,

how can I change the Application's main form (the form
I create within Application.Run(new someForm()), so I
can open another form, close this main form without the
Application will be closed. Is there a way around this
problem without writing code like this in Compact Framework ?:

while (!finished)
{
      if (showSomeForm)
      {
           Application.Run(new someForm());
      }
      else if (showSomeOtherForm)
      {
          Application.Run(new someOtherForm());
      }
}

Greetz,

eltic
LVL 5
elticAsked:
Who is Participating?
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
I think you've got the best solution already then.

I think you're only other option is to hide the main form instead of closing it so the application doesn't quit.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Hi eltic,

I don't know if this works in the Compact Framework but in the full version of .Net you create your own instance of the ApplicationContext() class. I have posted two differenct approaches here:
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_21274481.html

The link in that PAQ shows how to completely close one form and open another.  The code in the PAQ shows how to switch between the forms without closing them.

Hope it helps...

~IM
0
 
elticAuthor Commented:

Unfortunatly, there is no ApplicationContext class in compact framework.
Is there another way to play around this ?

Patrick
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.