Example #1
0
        private void ShowNewForm(object sender, EventArgs e)
        {
            Form childForm = null;

            ToolStripMenuItem m = (ToolStripMenuItem)sender;

            switch (m.Tag)
            {
            case "Reservations":

                this.panel2.Controls.Clear();
                childForm          = new Reservations(this);
                childForm.TopLevel = false;
                this.panel2.Controls.Add(childForm);
                break;

            case "ViewReservation":
                this.panel2.Controls.Clear();
                childForm          = new ReservationView(this);
                childForm.TopLevel = false;
                this.panel2.Controls.Add(childForm);
                break;
            }

            if (childForm != null)
            {
                foreach (Form f in this.MdiChildren)
                {
                    if (f.GetType() == childForm.GetType())
                    {
                        f.Activate();
                        return;
                    }
                }

                //childForm.MdiParent = this;
                childForm.Show();
            }
        }