Beispiel #1
0
        private void deleteBtn_Click(object sender, EventArgs e)
        {
            int rowIndex     = dataGridViewTest.CurrentCell.RowIndex;
            var row          = dataGridViewTest.Rows[rowIndex];
            var changedValue = (string)row.Cells[rowIndex].Value;

            Console.WriteLine("$$$$$$$$$$$$$$$$$ values:{0}", (string)row.Cells[rowIndex].Value);
            // dataGridViewTest.Rows.RemoveAt(rowIndex);

            Category categoryRef1 = new Category();

            categoryRef1.categoryName = Convert.ToString(row.Cells["categoryName"].Value);
            categoryRef1.categoryDesc = changedValue;
            CategoryDAO categoryDAORef = new CategoryDAOImpl();

            categoryDAORef.deleteCategory(categoryRef1);
            dataGridViewTest.Update();
            dataGridViewTest.Refresh();
        }