private void buttonDelete_Click(object sender, EventArgs e) { //Get Product ID int Product_ID = int.Parse(textBoxProductID.Text.Trim()); if (Product_ID != 0 || textBoxProductID.Text != null) { Product P = new Product(); P.ProductID = Product_ID; //Create Object of ProductDAL ProductDAL dal = new ProductDAL(); bool success = dal.Delete_Product(P); if (success == true) { MessageBox.Show("Product Successfully Deleted."); //Refresh DataTable dt = dal.Select_Product(); dataGridViewProduct.DataSource = dt; //Clear clear(); } else { MessageBox.Show("Failed to Delete Product. Try Again."); } } else { MessageBox.Show("Please Select the Product FIrst."); } }