Пример #1
0
 private void Number_reg_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
 {
     try
     {
         if (!(Regex.IsMatch(Height.Text, @"^\d*$")))
         {
             Height.Clear();
             throw new Exception("Error!!! Неправильные символы");
         }
         else if (!(Regex.IsMatch(Weight.Text, @"^\d*$")))
         {
             Weight.Clear();
             throw new Exception("Error!!! Неправильные символы");
         }
         else if (!(Regex.IsMatch(Arms.Text, @"^\d*$")))
         {
             Arms.Clear();
             throw new Exception("Error!!! Неправильные символы");
         }
         else if (!(Regex.IsMatch(Waist.Text, @"^\d*$")))
         {
             Waist.Clear();
             throw new Exception("Error!!! Неправильные символы");
         }
         else if (!(Regex.IsMatch(Chest.Text, @"^\d*$")))
         {
             Chest.Clear();
             throw new Exception("Error!!! Неправильные символы");
         }
         else if (!(Regex.IsMatch(Leg.Text, @"^\d*$")))
         {
             Leg.Clear();
             throw new Exception("Error!!! Неправильные символы");
         }
         else if (!(Regex.IsMatch(Hip.Text, @"^\d*$")))
         {
             Hip.Clear();
             throw new Exception("Error!!! Неправильные символы");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }