Beispiel #1
0
        /**/


        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;

                case "frmReportViewer":
                    if (frmReportViewer == null)
                    {
                        frmReportViewer           = new frmReportViewer();
                        frmReportViewer.MdiParent = this;
                        frmReportViewer.Show();
                        frmReportViewer.BringToFront();
                    }
                    else if (frmReportViewer.IsDisposed == true)
                    {
                        frmReportViewer           = new frmReportViewer();
                        frmReportViewer.MdiParent = this;
                        frmReportViewer.Show();
                        frmReportViewer.BringToFront();
                    }
                    else
                    {
                        frmReportViewer.Activate();
                        frmReportViewer.Show();
                        frmReportViewer.BringToFront();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
        private void test1ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmReportViewer obj = new frmReportViewer();

            obj.Show();
        }