示例#1
0
 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!");
         }
     }
 }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            AddOrEditBookForm addBook = new AddOrEditBookForm(this);

            addBook.ShowDialog();
        }