private void btnDeleteComp_Click(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(txtComp.Text)) { DialogResult dr = MessageBox.Show("Do you want to delete.", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { mngStock.DeleteCompany(Convert.ToInt32(lblCmpInfo.Text)); GetProductAndCompany(); HideCompanyLabels(); } } } catch (Exception ex) { Logger.WriteErrorMessage(ex); } }