Nick_BE
Nick_BE

Reputation: 127

startup projects and windows forms

I have a one solution with 3 projects, three windowsforms. I would like to have my main/startup project for form1 and which has 2 buttons. These should start form2/project2 and form3/project3. But how can I do this ??

Upvotes: 0

Views: 181

Answers (2)

Marco
Marco

Reputation: 57573

You could set references to other projects and then try something like this:

Form2 frm2 = new Form2();
frm2.Show();

Form3 frm3 = new Form3();
frm3.Show();

or

YourClass2 cls2 = new YourClass2();
// Do what you need with it

Upvotes: 2

CodeCaster
CodeCaster

Reputation: 151586

Add a reference to Project2 and Project3 to Project1, then you can use the public classes from those projects.

private void Form1Button1_Click(object sender, EventArgs e)
{
    var newForm = new Project2.Form2();
    newForm.Show(); // or ShowDialog to block
}

Upvotes: 0

Related Questions