private void purchaseToolStripMenuItem_Click(object sender, EventArgs e) { //Purchase frmPurchase frmPurchase = Application.OpenForms["frmPurchase"] as frmPurchase; if (frmPurchase != null) { frmPurchase.WindowState = FormWindowState.Normal; frmPurchase.BringToFront(); frmPurchase.Activate(); } else { frmPurchase = new frmPurchase("0"); frmPurchase.MdiParent = this; frmPurchase.Dock = DockStyle.Fill; frmPurchase.Show(); } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { String PUCHSE_ID = dataGridView1.Rows[e.RowIndex].Cells["Column1"].Value.ToString(); frmPurchase frmPurchase = Application.OpenForms["frmPurchase"] as frmPurchase; if (frmPurchase != null) { frmPurchase.WindowState = FormWindowState.Normal; frmPurchase.BringToFront(); frmPurchase.Activate(); } else { frmPurchase = new frmPurchase(PUCHSE_ID); frmPurchase.MdiParent = this.ParentForm; frmPurchase.Dock = DockStyle.Fill; frmPurchase.Show(); } }