0

I've made another form in my project, and i wanted to know how to open inside of another form? Can you please help me!

Here is the code that I've got so far:

private void optionsToolStripMenuItem_Click(object sender, EventArgs e)
{
     ???
}

Help me, I'm a beginner In c#

H H
  • 263,252
  • 30
  • 330
  • 514
Bogdan0804
  • 27
  • 1
  • 5
  • possible duplicate of [How to open a new form from another form](http://stackoverflow.com/questions/3965043/how-to-open-a-new-form-from-another-form) – sertsedat Jun 21 '15 at 11:12

1 Answers1

1

There are two options:

  1. Designing a Form inside the Visual Studio Designer and open a new instance of this inside your code
  2. Create a new form and add elements (Labels, ...) inside your code

1:

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

2:

Form aForm = new Form();
aForm.Text = "Title";

//Add Elements
Label l1 = new Label();
l1.Text = "Some Text";
l1.Location = new Point(10, 10);

aForm.Children.Add(l1);

//Show Form
aForm.Show();
Simon
  • 1,244
  • 8
  • 21