Пример #1
0
        // Andy Gao
        private void addNewButton_Click(object sender, EventArgs e)
        {
            AddSupplierForm addsupplierform = new AddSupplierForm();

            addsupplierform.Show();
            this.Hide();
        }
Пример #2
0
        private void addNewSupplierToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Create a list of open forms and bool result
            List <Form> openForms = new List <Form>();
            bool        formIsNew = true;

            // Fill up a list of forms
            foreach (Form f in Application.OpenForms)
            {
                openForms.Add(f);
            }

            // Check if there is a the same form that user tries to open
            foreach (Form f in openForms)
            {
                if (f.Name == "AddSupplierForm")
                {
                    f.Focus();
                    formIsNew = false;
                }
            }

            // If form is not opened yet open a new one
            if (formIsNew == true)
            {
                AddSupplierForm supplierForm = new AddSupplierForm();
                supplierForm.MdiParent = this;
                supplierForm.Show();
            }
        }