示例#1
0
        private void button2_Click(object sender, EventArgs e)
        {
            HoldAccounts holdAccnt = new HoldAccounts();

            foreach (Form form in Application.OpenForms)
            {
                if (form.GetType() == typeof(HoldAccounts))
                {
                    //===============================================================================
                    //                      If form is already open
                    //===============================================================================
                    form.Activate();
                    holdAccnt = (HoldAccounts)Application.OpenForms["HoldAccounts"];
                    Classes.clsHoldAccounts.userid = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString());


                    holdAccnt.txtID.Text        = dataGridView1.SelectedRows[0].Cells["EmployeeID"].Value.ToString();
                    holdAccnt.txtName.Text      = dataGridView1.SelectedRows[0].Cells["LastName"].Value.ToString() + ", " + dataGridView1.SelectedRows[0].Cells["FirstName"].Value.ToString() + " " + dataGridView1.SelectedRows[0].Cells["MiddleName"].Value.ToString() + dataGridView1.SelectedRows[0].Cells["Suffix"].Value.ToString();
                    holdAccnt.btnLock.Text      = "LOCK";
                    holdAccnt.btnCancel.Visible = true;
                    this.Close();
                    return;
                }
            }

            Classes.clsHoldAccounts.userid = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString());
            holdAccnt.txtID.Text           = dataGridView1.SelectedRows[0].Cells["EmployeeID"].Value.ToString();
            holdAccnt.txtName.Text         = dataGridView1.SelectedRows[0].Cells["LastName"].Value.ToString() + ", " + dataGridView1.SelectedRows[0].Cells["FirstName"].Value.ToString() + " " + dataGridView1.SelectedRows[0].Cells["MiddleName"].Value.ToString() + dataGridView1.SelectedRows[0].Cells["Suffix"].Value.ToString();
            holdAccnt.btnLock.Text         = "LOCK";
            holdAccnt.btnCancel.Visible    = true;
            this.Close();
        }
        private void panel1_Click(object sender, EventArgs e)
        {
            //controls
            foreach (Form form in Application.OpenForms)
            {
                if (form.GetType() == typeof(HoldAccounts))
                {
                    form.Activate();
                    return;
                }
            }

            HoldAccounts frm = new HoldAccounts();

            frm.Show();
            frm.MdiParent = this;
        }
        private void button21_Click(object sender, EventArgs e)
        {
            //Hide Panel
            panelMembership.Visible = false;

            //controls
            foreach (Form form in Application.OpenForms)
            {
                if (form.GetType() == typeof(HoldAccounts))
                {
                    form.Activate();
                    return;
                }
            }

            HoldAccounts frm = new HoldAccounts();

            frm.Show();
            frm.MdiParent = this;
        }