Creating MDI Application

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Creating MDI Application 1 2 3 Create new Windows Application In Form1 properties change IsMdiContainer = true Add one ToolStrip

ip control with Four Buttons, your UI should look like this:

4 5 6 7 8 9 10 11 12

Add New Windows Form from Project Menu. Enter Form Name: frmStudent Add one label with Text : Students Info Save and Close frmStudent. Add new Windows Form from Project Menu. Enter Form Name : frmTeacher Add one Label with Text : Teachers Info Save and close frmTeacher Open Form1 click View Menu Code, enter following declarations

//child forms frmStudent st; frmTeacher t;


13 Inside Constructor of Form1, add following lines:

//create child forms and set parent st = new frmStudent(); st.MdiParent = this; t = new frmTeacher(); t.MdiParent = this;
14 Double click on Student button, add following lines:

//if no form present or visible if (st == null||!st.Visible) { //then create new one! st = new frmStudent(); st.MdiParent = this; } st.Show();
15 Double click on Teacher button, add followings:

if (t == null|| !t.Visible)

{ t = new frmTeacher(); t.MdiParent = this; } t.Show();


16 Code for Cascade button:

LayoutMdi(MdiLayout.Cascade);
17 Code for Tile Button:

LayoutMdi(MdiLayout.TileHorizontal);

You might also like