How redirect one form to other form through MDI form


MDI form design







Today we are going to teach you how redirect one form to another form through MDI form
first put menustrip in form and give name like file,edit etc and take second form.
design part is ready.Now learning coding part.

Coding part



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 mdiform
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form2 frm = new Form2();
            frm.MdiParent = this;
            frm.Show();
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if(ActiveForm != null)
            {
                ActiveForm.Close();
            }
        }

           
       
    }

}







Comments