Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 416
  • Last Modified:

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
0
eltic
Asked:
eltic
  • 3
1 Solution
 
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
 
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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now