private void btnUpdate_Click(object sender, EventArgs e) { Product product = new Product { Id = Convert.ToInt32(dgwProducts.CurrentRow.Cells[0].Value), Name = tbxUpdateName.Text, UnitPrice = Convert.ToDecimal(tbxUpdateUnitPrice.Text), StockAmount = Convert.ToInt32(tbxUpdateStock.Text), }; _productDal.UpdateProduct(product); UpdateTable(); MessageBox.Show("Product Updated!"); }