free4vn
asked on
Help me about DateTimePicker
How to plus more day to DateTimePicker current
DateTime d = DateTimePicker.Value;
d.AddDays(1d);
DateTimePicker.Value = d;
d.AddDays(1d);
DateTimePicker.Value = d;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yes, or as AlexFM shows yoiu can do it as a single line of code...I was just trying to break it down.
Actually, DateTime.AddDays returns DateTime and doesn't change current instance, so you version should be changed.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
becuase the DateTimePicker has already this functionality!! Just place a DateTimePicker on a form and focus the date portion and it will role up or down on up down keys. Same is true for month/years ..