private void btnDelete_Click(object sender, EventArgs e) { try { int a = int.Parse(txtId.Text); } catch (Exception ex) { MessageBox.Show("Fail, try again!"); return; } int ID = int.Parse(txtId.Text); if (bm.RemoveProduct(ID)) { DataRow row = dtProduct.Rows.Find(ID); dtProduct.Rows.Remove(row); MessageBox.Show("Successful"); } else { MessageBox.Show("Fail"); } }