Main form - Sub form problem

V

Vladimir O¾ura

I am building a Pocket PC application in C#. I have 5 forms (1 main and 4
sub forms). The main form must always

load first. The sub forms are loaded from the main form. The application is
run using Application.Run(new

MainForm()); The user may choose to load one of the sub forms automaticaly
at startup, but when I do the folowing

in the MainForm_Load(......) function the Main form always shows up infront
of the subform:
private void MainForm_Load(.....)
{
...
...
SubForm sub = new SubForm();
sub.Show();
sub.BringToFront();
this.Hide();
this.SendToBack();
...
...
}

Is there a way that I can load the Main form and then automaticaly load one
of the sub forms with the sub form

being shown infront of the main form? Sub forms cannot exist if there is no
main form.
 
C

Chris Dunaway

Vladimir said:
Is there a way that I can load the Main form and then automaticaly load one
of the sub forms with the sub form

being shown infront of the main form? Sub forms cannot exist if there is no
main form.

Perhaps overload the constructor to take an integer which indicates
which subform to load. The show the main form and then the sub form.

You also might try setting the subform's parent or owner to the main
form. That might make it stay in front.
 

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