Yes, see the MSDN documentation . In particular, the OnValueChanged event
You will need to connect your control using this event:
In the constructor method:
dateTimePickerControl.ValueChanged += new EventHandler(picker_ValueChanged);
And here is the method signature:
void f_ValueChanged(object sender, EventArgs e) {
You can also do this from the designer. If you go to the "Properties", then "Events" section, it lists all the events. Just double click and it will create the signature and posting method for you.
UPDATE TO YOUR UPDATE
If you specifically want to check if this is a software change or not, then you want to do something like this:
Create a global variable in your class
Boolean isProgrammaticEvent = false ;
Before making changes to the program:
isProgrammaticEvent = true;
In the event posting:
void f_ValueChanged(object sender, EventArgs e) { Boolean isThisProgrammatic = isProgrammaticEvent; isProgrammaticEvent = false; if(isThisProgrammatic) return;
source share