Beispiel #1
0
        private void bindingNavigatorEditItem_Click(object sender, EventArgs e)
        {
            EditBook newBook = new EditBook
            {
                Owner = this
            };

            isAdd = false;
            dBook.Remove(setNewBook);
            newBook.ShowDialog();
            dBook.Add(setNewBook, idBookSender);

            dt.Rows[dataGridViewBook.CurrentRow.Index]["Books"] = setNewBook;
        }
Beispiel #2
0
        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            EditBook newBook = new EditBook
            {
                Owner = this
            };

            isAdd = true;

            newBook.ShowDialog();
            // removes an empty string at the end of the datagridview
            dataGridViewBook.Rows.RemoveAt(dataGridViewBook.Rows.Count - 1);
            if (isAdd)
            {
                DataRow newRow = dt.NewRow();
                newRow["Books"] = setNewBook;
                dt.Rows.Add(newRow);
                dBook.Add(setNewBook, idBookSender);
            }
        }