コード例 #1
0
 private void editBookToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (booksDataGridView.CurrentCell.OwningRow.DataBoundItem as Books != null)
     {
         AddEditBookForm addEditBookForm = new AddEditBookForm(booksDataGridView.CurrentCell.OwningRow.DataBoundItem as Books, publishers);
         addEditBookForm.ShowDialog();
         RefreshViews();
     }
 }
コード例 #2
0
 private void addNewBookToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if ((authorsDataGridView.CurrentCell.OwningRow.DataBoundItem as Authors) != null && booksDataGridView.AllowUserToAddRows && !booksDataGridView.CurrentCell.OwningRow.IsNewRow)
     {
         var             book            = new Books();
         AddEditBookForm addEditBookForm = new AddEditBookForm(book, publishers);
         addEditBookForm.ShowDialog();
         if (addEditBookForm.DialogResult == DialogResult.OK)
         {
             (authorsDataGridView.CurrentCell.OwningRow.DataBoundItem as Authors).Books.Add(book);
         }
     }
 }