Hello,

I'm working on a project that once ran (the main window) becomes maximised and then another window (Form2) pops up allowing the user to login OR register.

I have created the main project and added a form (called form2) but when I try to display Form2 when Form1 loads it won't let me...

private void Form1_Load()
{
      Form2.Show();
}

I don't know if I'm doing it incredibly wrong or not..

Someone help please? :)

private void Form1_Load() {
    Form2 myForm2 = new Form2();
    myForm2.ShowDialog();  // forces user to interact with Form2
}

Hey,

Thanks for that. It is showing, but the form that it loads is empty? The form2 has input boxes etc...

How do I get it to show this form, rather than create a new form?

Thanks :)

I have two forms... Form1 (Which is the main form)

I have form2 (The login form) - This form contains like input boxes etc.. Now when form1 loads, I want form two to show.. in form1.cs I have:

private void Form1_Load(object sender, EventArgs e)
{
     Form2 myForm2 = new Form2();
     myForm2.ShowDialog();
}

Now this code opens up a new form that doesn't have a title etc.. But I want it to show form2 (The one with the login details etc in)

Does this make sense? :)

No.
So open that form2. We cannot know which one is that your "login Form", can we?

Edited 5 Years Ago by Mitja Bonca: n/a

The login form is form2 that's the thing! It's just saved as form2.cs as I'm just trying stuff out!

Ahh i'm confused! :(!

Take a look into Solution Explorer, which forms go you have. Double click on one, that you see the design of each. And righ mouse of each of them and select "View code" to see the code editor. This way it will be easier for you to find out which form is which, and what is has.
Hope it helps,
Mitja

This question has already been answered. Start a new discussion instead.