I'm using some very basic code found in the visual studio help to do
some error checking on values entered on a form, it all works fine
until I try to do validation on a numericupdown control, and then I
get stuck in the control I am validating. Validation code is below:

        private void numericUpDown2_Validated(object sender, EventArgs
e)
        {
            // If all conditions have been met, clear the
ErrorProvider of errors.
            errorProvider1.SetError(numericUpDown1, "");
        }

        private void numericUpDown2_Validating(object sender,
CancelEventArgs e)
        {
            if ((numericUpDown2.Value + numericUpDown2.Value) > 8)
            {
                // Cancel the event and select the text to be
corrected by the user.
                e.Cancel = true;

                // Set the ErrorProvider error with the text to
display.
                this.errorProvider1.SetError(numericUpDown2, "Data
cannot go beyond message bounds, offset + number of bytes must be less
than or equal to 8");
            }

        }

Reply via email to