예제 #1
0
 public static void limitedNumberInputOnly(object sender, int max)
 {
     if (!handled)
     {
         TextBox obj = (TextBox)sender;
         if (Utils.hasExceeded(obj.Text, max) || !Utils.isValidNumber(Utils.getLastCharacter(obj.Text)))
         {
             handled = true;
             if (!Utils.isEmpty(obj.Text))
             {
                 obj.Text = obj.Text.Substring(0, obj.Text.Length - 1);
             }
         }
     }
     else
     {
         handled = false;
     }
 }