How can i reset my datetime control to display a date that is three months back instead of the current date.
Thanks in advance.
Printable View
How can i reset my datetime control to display a date that is three months back instead of the current date.
Thanks in advance.
The Value property of a DateTimePicker is a DateTime object, so that's the property you should be getting or setting if you want to make changes in code, e.g.VB Code:
myDateTimePicker.Value = Date.Today.AddMonths(-3)
Thanks, that will give me the same day 3 months back. What if i want the 1st day of the month, three months back!!
Think laterally!! You have the date three months ago and you want the date of the first day of that month. You can't set the Day of that specific Date object because it is ReadOnly, so you would create a new Date object with the same Year and Month but a Day of 1.
Yap, my own function. Thanks.
The problem i have, is that my datetime control is on a split container, when i toggle the container panel where it is, to false, it doesnt allow it, or rather changes it to date today. How can i pass over this!!
It works perfect when i put it in free space on the form and set the value of the control in the form load event.
Huh?
True....!! test it.