|
-
Jun 13th, 2006, 01:34 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Reset DateTime Control
How can i reset my datetime control to display a date that is three months back instead of the current date.
Thanks in advance.
-
Jun 13th, 2006, 02:46 AM
#2
Re: Reset DateTime Control
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)
-
Jun 13th, 2006, 03:53 AM
#3
Thread Starter
Hyperactive Member
Re: Reset DateTime Control
Thanks, that will give me the same day 3 months back. What if i want the 1st day of the month, three months back!!
-
Jun 13th, 2006, 04:26 AM
#4
Re: Reset DateTime Control
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.
-
Jun 13th, 2006, 04:36 AM
#5
Thread Starter
Hyperactive Member
Re: Reset DateTime Control
Yap, my own function. Thanks.
-
Jun 13th, 2006, 05:05 AM
#6
Thread Starter
Hyperactive Member
Re: Reset DateTime Control
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.
-
Jun 13th, 2006, 05:17 AM
#7
Re: [RESOLVED] Reset DateTime Control
-
Jun 13th, 2006, 05:24 AM
#8
Thread Starter
Hyperactive Member
Re: [RESOLVED] Reset DateTime Control
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|