displaying windows forms in panel in windows forms(c#)


after designing the form as above add what ever the forms you want to display in panel

then write the following code under button click event

  1. private void button1_Click(object sender, EventArgs e)
  2.     {
  3.         panel1.Controls.Clear();
  4.         Form2 f = new Form2();
  5.         f.TopLevel = false;
  6.         panel1.Controls.Add(f);
  7.         f.Show();
  8.     }

Advertisements

One thought on “displaying windows forms in panel in windows forms(c#)

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