Exemple #1
0
 private void txtCnpjCpf_Validated(object sender, EventArgs e)
 {
     if (txtCnpjCpf.Text.Length == 14 &&
         BancoDados.RetornarParametro("Sistema", "ValidarCNPJ") == "S" &&
         !Funcao.IsCnpj(txtCnpjCpf.Text))
     {
         Mensagem.Mostrar("Erro", "Dados do CNPJ Inválido, favor verificar !!!", "CONFIRMAR", 1);
         txtCnpjCpf.Focus();
     }
     else if (txtCnpjCpf.Text.Length == 11 &&
              BancoDados.RetornarParametro("Sistema", "ValidarCPF") == "S" &&
              !Funcao.IsCpf(txtCnpjCpf.Text))
     {
         Mensagem.Mostrar("Erro", "Dados do CPF Inválido, favor verificar !!!", "CONFIRMAR", 1);
         txtCnpjCpf.Focus();
     }
 }