private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0) { AddOrEditBookForm editBook = new AddOrEditBookForm(this, (int)booksGridView.Rows[e.RowIndex].Cells["Id"].Value); editBook.ShowDialog(); } else { if (e.ColumnIndex == 1) { DeleteBook((int)booksGridView.Rows[e.RowIndex].Cells["Id"].Value); RefreshData(); MessageBox.Show("Book deleted!"); } } }
private void button1_Click(object sender, EventArgs e) { AddOrEditBookForm addBook = new AddOrEditBookForm(this); addBook.ShowDialog(); }