Код: Выделить всё
foreach (DataGridViewRow row in dataGridView1.Rows)
{
string licensePlate = row.ToString();
int counter = 0;
//liceance plate value shoulde be like this format = 99XXX999 or 99XX9999
//not like this = 999XX999 or 999XXX99
for (int i = 0; i < 3; i++)
{
if (!char.IsDigit(licensePlate[i]))
{
counter++;
}
}
if (counter == 3)
{
MessageBox.Show("License plate value is not in the correct format.", "Uyarı",MessageBoxButtons.OK, MessageBoxIcon.Warning);
break;
}
else
{
}
}
Подробнее здесь: https://stackoverflow.com/questions/783 ... ate-format
Мобильная версия