コード例 #1
0
ファイル: MDIForm.cs プロジェクト: rawatdinu/My-Projects
        /**/


        public void ShowForm(string formName)
        {
            try
            {
                switch (formName)
                {
                case "UserRegistration":
                    if (UserRegistration == null)
                    {
                        UserRegistration           = new frmUserRegistration();
                        UserRegistration.MdiParent = this;
                        UserRegistration.Show();
                        UserRegistration.BringToFront();
                    }
                    else if (UserRegistration.IsDisposed == true)
                    {
                        UserRegistration           = new frmUserRegistration();
                        UserRegistration.MdiParent = this;
                        UserRegistration.Show();
                        UserRegistration.BringToFront();
                    }
                    else
                    {
                        UserRegistration.Activate();
                        UserRegistration.Show();
                        UserRegistration.BringToFront();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
ファイル: MDIForm.cs プロジェクト: rawatdinu/My-Projects
        /**/


        public void ShowForm(string formName)
        {
            try
            {
                switch (formName)
                {
                case "UserRegistration":
                    if (frmUserRegistration == null)
                    {
                        frmUserRegistration           = new frmUserRegistration();
                        frmUserRegistration.MdiParent = this;
                        frmUserRegistration.Show();
                        frmUserRegistration.BringToFront();
                    }
                    else if (frmUserRegistration.IsDisposed == true)
                    {
                        frmUserRegistration           = new frmUserRegistration();
                        frmUserRegistration.MdiParent = this;
                        frmUserRegistration.Show();
                        frmUserRegistration.BringToFront();
                    }
                    else
                    {
                        frmUserRegistration.Activate();
                        frmUserRegistration.Show();
                        frmUserRegistration.BringToFront();
                    }
                    break;


                case "frmBooksMaster":
                    if (frmBooksMaster == null)
                    {
                        frmBooksMaster           = new frmBooksMaster();
                        frmBooksMaster.MdiParent = this;
                        frmBooksMaster.Show();
                        frmBooksMaster.BringToFront();
                    }
                    else if (frmBooksMaster.IsDisposed == true)
                    {
                        frmBooksMaster           = new frmBooksMaster();
                        frmBooksMaster.MdiParent = this;
                        frmBooksMaster.Show();
                        frmBooksMaster.BringToFront();
                    }
                    else
                    {
                        frmBooksMaster.Activate();
                        frmBooksMaster.Show();
                        frmBooksMaster.BringToFront();
                    }
                    break;


                case "frmBooksTransactionIn":
                    if (frmBooksTransactionIn == null)
                    {
                        frmBooksTransactionIn           = new frmBooksTransactionIn();
                        frmBooksTransactionIn.MdiParent = this;
                        frmBooksTransactionIn.Show();
                        frmBooksTransactionIn.BringToFront();
                    }
                    else if (frmBooksTransactionIn.IsDisposed == true)
                    {
                        frmBooksTransactionIn           = new frmBooksTransactionIn();
                        frmBooksTransactionIn.MdiParent = this;
                        frmBooksTransactionIn.Show();
                        frmBooksTransactionIn.BringToFront();
                    }
                    else
                    {
                        frmBooksTransactionIn.Activate();
                        frmBooksTransactionIn.Show();
                        frmBooksTransactionIn.BringToFront();
                    }
                    break;


                case "frmBooksTransactionOut":
                    if (frmBooksTransactionOut == null)
                    {
                        frmBooksTransactionOut           = new frmBooksTransactionOut();
                        frmBooksTransactionOut.MdiParent = this;
                        frmBooksTransactionOut.Show();
                        frmBooksTransactionOut.BringToFront();
                    }
                    else if (frmBooksTransactionOut.IsDisposed == true)
                    {
                        frmBooksTransactionOut           = new frmBooksTransactionOut();
                        frmBooksTransactionOut.MdiParent = this;
                        frmBooksTransactionOut.Show();
                        frmBooksTransactionOut.BringToFront();
                    }
                    else
                    {
                        frmBooksTransactionOut.Activate();
                        frmBooksTransactionOut.Show();
                        frmBooksTransactionOut.BringToFront();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }