private void BtnDelete_Click(object sender, EventArgs e) { try { if (materialbll.Delete(int.Parse(txtMaterialID.Text)) == 0) { MessageBox.Show("Deleted successfuly"); } else { throw new Exception(); } } catch (Exception) { MessageBox.Show("This material is not deleted please contact your administrator"); } }