private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { 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 student where id=" + id; Database db = new Database(q); db.ExecuteNonQuery(); } } else { RegisterStudent rs = new RegisterStudent(id); rs.Show(); } }
private void newStudentToolStripMenuItem_Click(object sender, EventArgs e) { RegisterStudent rs = new RegisterStudent(0); rs.Show(); }