iyi akşamlar herkese
aşağıdaki metotta textboxtan gönderdiğim parametreyi kontrol edip 11 haneli ve sadece rakamdan oluşuyorsa tru değeri döndürmek istiyorum ama doğru sonuç alamıyorum. bi bakarsanız arkadaşlar size zahmet..
`
public bool tcno(string tcn)
{
if (tcn.Length != 11)
return false;
int tc_aded = 11;
tc_aded=tcn.Length - Regex.Replace(tcn, "[0-9]", "").Length;
MessageBox.Show(Convert.ToString(tc_aded));
if (tc_aded != 0)
return false;
return true;
}
private void button1_Click(object sender, EventArgs e)
{
txt_cls tcno_sor = new txt_cls();
bool tcno_durum = tcno_sor.tcno(textBox3.Text);
if (!tcno_durum)
errorProvider1.SetError(textBox3, "T.C. Numarası Hatalı");
else
{
errorProvider1.Clear();
MessageBox.Show("T.C. Doğru");
}
}
`