private void button1_Click(object sender, EventArgs e) { using (addstock stock = new addstock("", 0, 0, 0)) { stock.FormClosed += new FormClosedEventHandler(MyForm_FormClosed); stock.ShowDialog(); } }
private void tabPage1_Click(object sender, EventArgs e) { DataRow row = dt.Rows[dataGridView1.CurrentRow.Index]; Debug.Write("btn_Check_Click event called" + dataGridView1.CurrentRow.Index); using (addstock stock = new addstock(row["inventory_name"].ToString(), (int)row["inventory_quantity"], 1, (int)row["inventory_id"])) { stock.FormClosed += new FormClosedEventHandler(MyForm_FormClosed); stock.ShowDialog(); } }