Exemplo n.º 1
0
        private void bookList_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            string id     = bookList.Rows[e.RowIndex].Cells["ID"].Value.ToString();
            string title  = bookList.Rows[e.RowIndex].Cells["title"].Value.ToString();
            string author = bookList.Rows[e.RowIndex].Cells["author"].Value.ToString();
            string isbn   = bookList.Rows[e.RowIndex].Cells["isbn"].Value.ToString();
            string genre  = bookList.Rows[e.RowIndex].Cells["genre"].Value.ToString();

            if (e.RowIndex % 2 == 0)
            {
                bookList.Rows[e.RowIndex].Cells[e.ColumnIndex].Style = bookList.RowsDefaultCellStyle;
            }
            else
            {
                bookList.Rows[e.RowIndex].Cells[e.ColumnIndex].Style = bookList.AlternatingRowsDefaultCellStyle;
            }

            BookControl bc = new BookControl();

            bc.editBook(int.Parse(id), isbn, author, title, genre);
            MessageBox.Show(bc.Message);
        }