New Forms do not show on PocketPC

M

Markus Ewald

Hi!

I'm developing a small PocketPC application using the DotNET Compact
Framework. This application uses three Forms, which are brought to
screen like this:

private static void Main() {
System.Windows.Forms.Application.Run(new Form1());
System.Windows.Forms.Application.Run(new Form2());
}

When the application is started, Form1 shows up as normal. But when
Form1 is closed, Form2 will not be visible. I have to manually bring it
back to view by going to "System Settings", "Memory", "Running Programs"
and clicking on "Activate" there.

What am I doing wrong?

Thanks,
-Markus-
 
C

chris-s

Thats not really the approach to take, just Run the main form, then
create and show your sub forms from the main form eg

Form2 f = new Form2();
f.ShowModal();
f.Dispose();
f = null;

There is a sample somewhere of a form caching technique that may be
useful, do a bit more searching on this newsgroup.

Chris
 
M

Markus Ewald

Thats not really the approach to take, just Run the main form, then
create and show your sub forms from the main form eg

Form2 f = new Form2();
f.ShowModal();
f.Dispose();
f = null;
Thanks!

Looks like there's no .ShowModal() in the Compact Framework, but
..ShowDialog() ought to do the same. Forms also do not implement
IDisposable here, so I'm assuming .Close() will suffice. Whatever, it
works now.

I didn't use a main form originally because Form1 in my example happens
to be a license entry page where the user has to authenticate himself,
so I figured it wouldn't make sense loading the user interface before
this has happened. Changed it so I've got an empty main form with the
actual user interface being on another form.
There is a sample somewhere of a form caching technique that may be
useful, do a bit more searching on this newsgroup.

Chris

Ciao,
-Markus-
 
D

Daniel Moth

You only have one Application.Run per project/app. Additional forms should
be shown from the main form (via Show or ShowDialog).

Cheers
Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top