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 :)

Which form is empty, and which form is 'this' form?

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?

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

I'm an idiot :$ haha thank you for everyone that helped :) :)!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.