I’m new to c#, in my program im using DateTimePicker Value changed event but i found ValueChanged event occurs when the user clicks on arrow or if the value is changed programatically as well, I want to identify only the user interacts of the DateTimePicker (not when the value is changed programatically), Is there any way to do this?
Share
Yes, take a look at the MSDN documentation. Especially, the
OnValueChangedeventYou will need to wire your control up using this event:
In a constructor method:
And here is the method signature:
You can also do this from the designer. If you go to the Properties, then Events portion, it lists all of the events. Just double click and it will create the method signature and wiring for you.
UPDATE TO YOUR UPDATE
If you specifically want to check whether this is a programmatic change or not, then you want to do something like this:
Create a global variable in your class
Boolean isProgrammaticEvent = false;Before your programmatic change:
In your event wiring: