SpeakComputers.com
Home
Software
Electronics
Desktop Computers
Laptops
Games
Handheld Devices
Mobile Phones
Cameras
Camcorders
Printers
Books
Software Downloads 2012 Software Mac Software Security Student Editions Windows 7 Office 2010
ASP.NET C# VB.NET C++ .NET Infragistics DevComponents

Mdi - Multiple Document Interface.

Mdi - Multiple Document Interface applications allow you to have multiple documents open within the same application. This is a very popular application interface and can be seen in many modern day applications like, Mozilla Firefox, Internet Explorer 7.0, Microsoft Word and VisualStudio.


MDI applications using visual studio and the .net framework

Creating MDI applications is made really easy using VisualStudio 2005 and the Microsoft .net Framework.

Creating a basic MDI application.

Start VisualStudio and create a new Windows c# project. On the Solutions Explorer Tab, right click the project and click add new Form.

Your project should now consist of 2 forms. Form1 and Form2.
On Form1 Properties Window, ensure IsMdiContainer is set to true. Writing this in code is simple.

this.IsMdiContainer = true;

Create a Form1_Load event. In the load event add the following code.
Form2 note = new Form2();
note.MdiParent = this;
note.Show();

Now if you run the project (press F5) Form1 the mdiparent or container form is hosting Form2.

These are the basic principles of MDI applications. Of course the above example is of no use to anyone but you should have an idea of how the MDI applications work.

Sending information between MDI and SDI Forms

MDI Notepad.

Let's do another project with more detail and some interaction between the MDI forms. Download the complete source project for the MDI Notepad. In this project we are going to do some basic commands that will open multiple forms each having some NotePad functionality. We will show you how to call new forms from the MDI Container as well as from a MDI child. We will also show you how to do some Menu merging.

Creating new Mdi Children.
Creating Mdi children is easy and there are several ways to do this.

From the MdiParent.
NotePad note = new NotePad(); note.MdiParent = this; note.Show();

From a MdiChild.
NotePad note = new NotePad(); note.MdiParent = this.MdiParent; note.Show();

From the Mdi Child via a method or function on the Mdi Parent.
On the Mdi Parent you will create a function that is accessible from the Mdi Child.
public void NewNote() { NotePad note = new NotePad(); note.MdiParent = this; note.Show(); }

From the Mdi Child you will reference the Mdi Parent and Execute that function.
Form1 mainForm = (Form1)this.MdiParent; mainForm.NewNote();
Computer Security
AntiVirus Software
Internet Security
Parental Controls
Backup & Recovery
Computer Protection
Anti Malware
Photo & Video
Photo & Video Editing
Video Music
Desktop Publishing
Professional Design
Home Publishing
Clipart
Business & Accounting
Accounting
Payroll
Check Printing
TAX
H&R Block
Microsoft Office
Design
Graphic Design
Home Design
Garden Design
Interior Design
Computer Aided Design
3D Design
Students & Teacher
Adobe
Microsoft Office
Dragon Naturally Speaking
Corel Draw
Serif
Student/Teacher Software
Copy Right 2006 SpeakComputers.com - All Rights Reserved.
Home About Privacy Policy Resouces