private void btExcluir_Click(object sender, EventArgs e) { try { DialogResult d = MessageBox.Show("Deseja excluir o registro?", "Aviso", MessageBoxButtons.YesNo); if (d.ToString() == "Yes") { DALConexao cx = new DALConexao(DadosDaConexao.StringDeConexao); BLLPedido bll = new BLLPedido(cx); bll.Excluir(Convert.ToInt32(txtCodigo.Text)); this.LimpaTela(); this.alteraBotoes(1); } } catch { MessageBox.Show("Impossivel excluir o registro.\n\nO Registro esta sendo usado em outro local."); alteraBotoes(3); } }