Main form - Sub form problem

  • Thread starter Thread starter Vladimir O¾ura
  • Start date Start date
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.
 
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.
 
Back
Top