예제 #1
0
파일: InputBox.cs 프로젝트: GDuggi/DemoTest
 /// <summary>
 /// Validate the Text using the Validator
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void textBoxText_Validating(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (Validator != null)
     {
         InputBoxValidatingArgs args = new InputBoxValidatingArgs();
         args.Text = textBoxText.Text;
         Validator(this, args);
         if (args.Cancel)
         {
             e.Cancel = true;
             errorProviderText.SetError(textBoxText, args.Message);
         }
     }
 }
예제 #2
0
 private void inputBox_Validating(object sender, InputBoxValidatingArgs e)
 {
     if (e.Text.Trim().Length > 0)
     {
         try
         {
             Convert.ToInt32((e.Text.Trim()));
         }
         catch (Exception err)
         {
             e.Cancel = true;
             e.Message = err.Message;
         }
     }
     else
     {
         e.Cancel = true;
         e.Message = "Required / Invalid Number";
     }
 }
예제 #3
0
 /// <summary>
 /// Validate the Text using the Validator
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void textBoxText_Validating(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (Validator != null)
     {
         InputBoxValidatingArgs args = new InputBoxValidatingArgs();
         args.Text = textBoxText.Text;
         Validator(this, args);
         if (args.Cancel)
         {
             e.Cancel = true;
             errorProviderText.SetError(textBoxText, args.Message);
         }
     }
 }