Hi, I have a DateTimePicker on one of my forms and when the user change the date I have some code in the _ValueChanged event handler.
Part of the code has a Confirm MessageBox that allows the user to confirm whether he wants to change the date or not. If the user selects no then I change the date back to the original...
Code
I deal with the new _ValueChanged event fired by dtpExpVector.Value = prevDate using the booleans above.
My problem is that for some reason the _ValueChagned event appears to be getting fired an extra time at the end with the date the user selected. Does anybody know why?
It appears to be the line dtpExpVector.Value = prevDate; that is causing the extra event to be fired. I expect it to fire 1 event but it actually seems to fire 2.
For example if the DateTimePicker shows 22nd March and I change it to 9th March I get the following events:
Event 1: _ValueChanged(9th March)
If the user then rejects the change the line dtpExpVector.value = prevDate; is called so:
Event 2: _ValueChanged(22nd March).
This is what I expect but a 3rd Event gets called:
Event 3: _ValueChanged(9th March).
It is this 3rd event that I can't explain.
Thanks.
Wallace