コード例 #1
0
 //редактируем выделенную запись таблицы
 private void editRecordbutton_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow row in storeDataGridView.SelectedRows)
     {
         if (row.Selected)
         {
             int index = row.Index;
             if (EditButtonClicked != null)
             {
                 EditButtonClicked(this, new ObjectEventArgs(index));
                 break;
             }
         }
     }
     if (EditingBook != null)
     {
         AddBookDialogWindow = new bookForm(EditingBook);
         AddBookDialogWindow.ErrorOccurred += AddBookDialogWindow_ErrorOccurred;
         if (AddBookDialogWindow.ShowDialog(this) == DialogResult.OK)
         {
             DGVStoreSource.ResetBindings();
         }
         AddBookDialogWindow.Dispose();
         EditingBook = null;
     }
 }
コード例 #2
0
 //добавляем запись в таблицу
 private void addRecordbutton_Click(object sender, EventArgs e)
 {
     AddBookDialogWindow = new bookForm();
     AddBookDialogWindow.ErrorOccurred += AddBookDialogWindow_ErrorOccurred;
     if (AddBookDialogWindow.ShowDialog(this) == DialogResult.OK)
     {
         Book anotherBook = AddBookDialogWindow.DisplayedBook;
         if (AddButtonClicked != null)
         {
             AddButtonClicked(this, new ObjectEventArgs(anotherBook));
         }
     }
     AddBookDialogWindow.Dispose();
 }