Monday, 24 August 2015

MDI (Multiple Document Interface) form with C# Language

MDI Multiple Document Interface with C# Language 


MDI MDI Multiple Document Interface applications allow to display multiple documents at the same time, with each document displayed in its own window.   

Creating MDI Multiple Document Interface Parent Forms

MDI parent form is the base of   MDI. This is the form that holds the MDI child windows, which are all the sub windows in which the client work together with the mdi application.

Create a new form and add the code

this.IsMdiContainer=true;

Create MDI child forms

form frmchild=new form();
frmchild.mdiparent=this;
frmchild.show(); 

E.g.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace alhuda_marksheet
{
    public partial class MDIParentuser : Form
    {
       

        public MDIParentuser()
        {
            InitializeComponent();
        }

    

        private void admissionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ActiveMdiChild != null)
                ActiveMdiChild.Close();
            Form1 obj = new Form1();
            obj.MdiParent = this;
            obj.Show();

        }

        private void marksToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ActiveMdiChild != null)
                ActiveMdiChild.Close();
            marks obj = new marks();
            obj.MdiParent = this;
            obj.Show();

        }

        private void reportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ActiveMdiChild != null)
                ActiveMdiChild.Close();
            report obj = new report();
            obj.MdiParent = this;
            obj.Show();
        }

        private void logoutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            login obj = new login();
            obj.Show();
            this.Hide();
        }
    }

}




No comments:

Post a Comment