private void btnDelete_Click(object sender, EventArgs e) { //get the Id of dealer or customer to be deleted dc.id = int.Parse(txtDeaCustID.Text); //Create boolean variable to check if the dealer or customer is deleted bool success = dcdal.delete(dc); //If the dealer or customer is deleted successfully the value of success will be true else it will be false. if (success == true) { //dealer or customer deleted successfully MessageBox.Show("Dealer or Customer is Delected successfully"); Clear(); //Refreshing the Data Grid view DataTable dt = dcdal.select(); dgvDeaCust.DataSource = dt; } else { //failed to delete deal or customer MessageBox.Show("Failed to delete products"); } }