Using DateTimePicker with a checkbox and up down control
Posted on 2011-04-26
I am using VB2010 and winforms.
I am working with a DateTimePicker control where the ShowCheckBox is true and ShowUpDown is true. The format of the control is Short Date.
I am having a problem when the control is originally unchecked, and then the user checks it to enable it and tries to use the up and down arrows, but nothing happens. I am guessing this is because none of the fields (month, day or year) are selected, so it doesnt know what is supposed to be increased/decreased. I cant see any events that i can use to either select the day field, or capture the up down events to manually increase/decrease the date. In addition, when the user increases the day past the end of the month, i would like it to go to the next month/year (ie they increase date from 1/30/10 to 1/31/10 and then 2/1/10 instead of it going back to 1/1/10). Really i need to capture the click on the up and down buttons to do this...
any suggestions? If i cant do this, i will need to use 3 seperate controls (checkbox, textbox and a up down control) and lots of code.