Hide windows form onLoad

G

Guest

When i load up my application I want to Hide the start form and open up a
preview form,

Im trying with
private void Form1_Load(object sender, System.EventArgs e)
{
this.Hide();
Form form2 = new Form2();
form2.Show();
}

but its not hiding the first form,
what am i doing wrong?

but
 
S

Shishir Kumar Mishra

Hi,
Any specific reason to load form1 first? From application you can always
load your preview from first (Form2).
You can always creates instance of form1(main form) from preview and show it
after closing of form2.

Regards
Shishir Kumar Mishra
Manhattan Associates
 
H

Herfried K. Wagner [MVP]

Leon said:
When i load up my application I want to Hide the start form
and open up a preview form,

In addition to the other reply:
Im trying with
private void Form1_Load(object sender, System.EventArgs e)
{
this.Hide();

Your form is not yet visible here!
Form form2 = new Form2();
form2.Show();

Your form will be visible here. In order to prevent the form from becoming
visible, use 'ShowDialog' instead of 'Show' or take a look at the
'Application' and 'ApplicationContext' classes.
 
G

Guest

I have an preview window and a edit window, what I want is that when I double
click a file it should open the preview mode, but otherwise if you start the
program manually it should open in edit mode, i then would like to have an
edit button in the preview form and a preview button in the edit form, so you
can jump between the two.

in the mainform:

if(args.Length != 0)
{
Application.Run(new Player(args[0]));
} else {
Application.Run(new Maker());
}


This works fine.. the problem is switching between the two forms...

Cheers
 

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