private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { int id = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["Id"].Value); if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().ToLower() == "delete") { if (MessageBox.Show(" Are you ", "Delete", MessageBoxButtons.OKCancel) == DialogResult.OK) { string q = "delete from Batch where id =" + id; Database db = new Database(q); db.ExecuteNonQuery(); } } else { New_Batch nb = new New_Batch(id); ///nb.myID = id; nb.Show(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void NewBatchToolStripMenuItem_Click(object sender, EventArgs e) { New_Batch nb = new New_Batch(); nb.Show(); }