c# - datetimepicker control -
which event should fired when user selects date in datetimepickercontrol ? used datetimepicker1_valuechanged () . fired when user scroll through date time picker.
i want fired when user makes change. combobox selectionchagedcommitted event.
take @ msdn documentation. especially, onvaluechanged event
you need wire control using event:
in constructor method:
datetimepickercontrol.valuechanged += new eventhandler(picker_valuechanged);
and here method signature:
void f_valuechanged(object sender, eventargs e) { //do whatever need when value changes here }
you can designer. if go properties, events portion, lists of events. double click , create method signature , wiring you.
update update
if want check whether programmatic change or not, want this:
create global variable in class
boolean isprogrammaticevent = false;
before programmatic change:
isprogrammaticevent = true; //change picker value
in event wiring:
void f_valuechanged(object sender, eventargs e) { boolean isthisprogrammatic = isprogrammaticevent; isprogrammaticevent = false; if(isthisprogrammatic) return; }
Comments
Post a Comment