Esempio n. 1
0
 private void FathernameTextBox_KeyPress(object sender, KeyPressEventArgs e)
 {
     if ((!char.IsControl(e.KeyChar) && !char.IsLetter(e.KeyChar)) ||
         (FathernameTextBox.TextLength == 0 && char.IsLower(e.KeyChar)) ||
         (FathernameTextBox.TextLength > 0 && char.IsUpper(e.KeyChar)))
     {
         e.Handled = true;
         FathernameErrorProvider.SetError(FathernameTextBox, "введен недопустимый символ");
     }
     else
     {
         FathernameErrorProvider.Clear();
         if (FathernameTextBox.BackColor == Color.IndianRed)
         {
             FathernameTextBox.BackColor = Color.White;
         }
     }
 }
Esempio n. 2
0
 private void FathernameTextBox_Leave(object sender, EventArgs e)
 {
     FathernameErrorProvider.Clear();
 }