private void btnExcluir_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult mensagem = MessageBox.Show("Desaja excluir o registro?", "Aviso", MessageBoxButtons.YesNo);

                if (mensagem.ToString().Equals("Yes"))
                {
                    DALConexao con = new DALConexao(DadosConexao.StringConexao);

                    BLLUnidadeMedida um = new BLLUnidadeMedida(con);

                    um.Excluir(Convert.ToInt32(txtCodigo.Text));

                    this.LimparCampos();

                    this.AlteraBotoes(1);
                }

            }
            catch
            {
                MessageBox.Show("Erro ao excluir registro");

                this.AlteraBotoes(3);
            }
        }
        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(DadosConexao.StringDeConexao);
                    BLLUnidadeMedida bll = new BLLUnidadeMedida(cx);
                    bll.Excluir(Convert.ToInt32(txtCodigo.Text));
                    this.LimpaTela();
                    this.alteraBotoes(1);
                }
            }
            catch
            {
                MessageBox.Show("Impossível excluir o registro.\n Pois o mesmo está sendo utilizado em outro local.");
                this.alteraBotoes(3);

            }
        }