public void Cedula(string num)
{
num_cedula = num;
comprobar_num();
}
public void comprobar_num()
{
int suma = 0;
int j = 0;
bool a = true;
int x = 0;
for (int i = 0; i < 9; i++)
{
j = Convert.ToInt16(num_cedula[i].ToString());
if (a == true)
{
x = j * 2;
if (x > 9)
{
x = 1 + (x % 10);
}
a = false;
}
else
{
x = j * 1;
a = true;
}
suma += x;
}
x = suma % 10;
j = Convert.ToInt32(this.num_cedula[9].ToString());
if (x == 0)
{
if (x == j)
{
res = true;
}
}
else
{
x = (suma - x) + 10;
if (j == (x - suma))
{
res = true;
MessageBox.Show("correcta");
}
else
{
res = false;
MessageBox.Show("incorrecta");
dataGrid2.Focus();
}
}
}