Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void FrmCliente_Load(object sender, EventArgs e)
- {
- if (mskCPF.Text != "")
- {
- btnvalidacliente.Enabled = false;
- btnvalidacliente.Enabled = true;
- }
- }
- private void nome_Click(object sender, EventArgs e)
- {
- // nao consegui alguem pode me ajudar
- }
- public static bool cpf_Click(string cpf, EventArgs e)
- {
- int[] multiplicador1 = new int[9] { 10, 9, 8, 7, 6, 5, 4, 3, 2 };
- int[] multiplicador2 = new int[10] { 11, 10, 9, 8, 7, 6, 5, 4, 3, 2 };
- string tempCpf;
- string digito;
- int soma;
- int resto;
- cpf = cpf.Trim();
- cpf = cpf.Replace(".", "").Replace("-", "");
- if (cpf.Length != 11)
- return false;
- tempCpf = cpf.Substring(0, 9);
- soma = 0;
- for (int i = 0; i < 9; i++)
- soma += int.Parse(tempCpf[i].ToString()) * multiplicador1[i];
- resto = soma % 11;
- if (resto < 2)
- resto = 0;
- else
- resto = 11 - resto;
- digito = resto.ToString();
- tempCpf = tempCpf + digito;
- soma = 0;
- for (int i = 0; i < 10; i++)
- soma += int.Parse(tempCpf[i].ToString()) * multiplicador2[i];
- resto = soma % 11;
- if (resto < 2)
- resto = 0;
- else
- resto = 11 - resto;
- digito = digito + resto.ToString();
- return cpf.EndsWith(digito);
- }
- private void email_Click(object sender, EventArgs e)
- {
- // nao consegui alguem pode me ajudar
- }
- private void datadeentrada_Click(object sender, EventArgs e)
- {
- // nao consegui alguem pode me ajudar
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement