100% found this document useful (1 vote)
399 views

Creating MDI Application

This document provides instructions for creating a basic multiple document interface (MDI) application in C# with two child forms - one for students and one for teachers. It describes adding an MDI container form, toolstrip buttons to open the child forms in different layouts, and code to instantiate and display the child forms when their respective buttons are clicked.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
399 views

Creating MDI Application

This document provides instructions for creating a basic multiple document interface (MDI) application in C# with two child forms - one for students and one for teachers. It describes adding an MDI container form, toolstrip buttons to open the child forms in different layouts, and code to instantiate and display the child forms when their respective buttons are clicked.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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