I'm programming a winforms app, and I have encountered a problem:
I have, for example, a numeric UpDown control, and when pressing the up/down button, I don't want it to change, but I want access to the new value, without changing the number on the control itself.
I need as well to be able to unlock it under some condition, so it would look like that:
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
if (!canChange)
{
int newValue = get_expected_new_value();
doSomeStuff(newValue);
//some_code_to_cancel_the_value_change;
}
else
{
//allow the change
doSomeOtherStuff();
}
}
How can I do thins thing?