Beispiel #1
0
 private void StartNumberTextBox_TextChanged(object sender, EventArgs e)
 {
     StartNumberTBErrorProvider.Clear();
     try
     {
         startNumber = Int32.Parse(StartNumberTextBox.Text);
     }
     catch (Exception ex)
     {
         StartNumberTBErrorProvider.SetError(StartNumberTextBox, ex.Message);
     }
 }
Beispiel #2
0
        //parsing the text from controls in order to set an error message to the rigth control if there is incorrect data in that control
        private int TextBoxTextParse(Control control)
        {
            int retValue = 0;

            try
            {
                retValue = Int32.Parse(control.Text);
            }
            catch (Exception ex)
            {
                StartNumberTBErrorProvider.SetError(control, ex.Message);
            }
            return(retValue);
        }