Setting MDI Parent And Child Form at Visual Studio 2008 with C#

Posted: Monday,November 17, 2008 in C#
Tags: , , ,

Berikut adalah langkah-langkah mudah di dalam mensetting MDI Form beserta form-form childnya. Agar form child bisa berada di dalam form parent.

1. Buka visual studio 2008.

2. File -> New -> Project

3. Pilih Windows Form Application. Ok

4. Pada Properties Form1, Ubah IsMdiContainer menjadi True. Sehingga Form1 ini akan berubah menjadi MDI Parent.

5. Pada WindowsFormApplication di Solution Explorer, Add -> Windows Form -> Form2.cs . Add

6. Pada Design Form1.

Click Toolbox -> Menu&ToolBars -> MenuStrip(Double Click / Drag ke Form1)

7. Ketik Form2 pada MenuStrip tadi. Lalu Double Click.

8. Ketikkan kode berikut :

private void form2ToolStripMenuItem_Click(object sender, EventArgs e)
{
Form2 frm = new Form2();
frm.MdiParent = this;
frm.Show();
}

9. Start Debugging / Tekan F5.

Semoga Membantu…

Comments
  1. Kelly says:

    Hi, I’m trying to create the parents form with multiple child form. But I’m having some problems when debugging the project. Before I created the parent form, I debug the child forms, but only 1 child form is appeared. After that I create another new project, create one child form and one parent form, when I debug, just the child form appeared. However, my coding is same as yours, just the variables and objects are different.

  2. Kelly says:

    Hi, I’m trying to create the parents form with multiple child form. But I’m having some problems when debugging the project. Before I created the parent form, I debug the child forms, but only 1 child form is appeared. After that I create another new project, create one child form and one parent form, when I debug, just the child form appeared. However, my coding is same as yours, just the variables and objects are different. Can you help me with this?

  3. ihsan says:

    kalau pada saat klik form2 kemudian form1 menjadi tidak aktif bagaimana caranya?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s