问题
how can I achieve that if the User types in the day in my DateTimePicker
it focuses automatically the month part of it, and after typing that one in it goes to the Year part?
Because I don't want him to have to press the right-key to focus it... is there a way to do this programmatically?
It is not possible that the user clicks already on the month or year part, because he does all with the keyboard, and focuses the DateTimePicker
by pressing TAB.
The Format is short: DD/MM/YYYY
...
Anybody knows?
回答1:
try using the event valuechanged
try this:
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
SendKeys.Send("{Right}");
}
basically the focused part changes when you press the right arrow that code line simulate a right arrow key press
来源:https://stackoverflow.com/questions/11242033/go-to-month-and-year-directly-on-datetimepicker-in-c-sharp