Under certain conditions I'd like to cancel the ValueChanged
event of a NumericUpDown
control in Winforms (e.g. when the value set in the control is too high in relation to another value in a TextBox
).
However, the EventArgs
passed as argument into the event handler for the NumericUpDown
control doesn't offer anything like "Cancel", so how can I do it?
private void nudMyControl_ValueChanged(object sender, EventArgs e)
{
// Do some stuff, but only if the value is within a certain range.
// Otherwise, cancel without doing anything.
}