|
-
Mar 31st, 2006, 09:05 AM
#1
Thread Starter
Hyperactive Member
SOLVED: Adding day(s) to a date : S
I saw some posts about it and tried to duplicate, but it is not working.
Here is my code:
Code:
dteDays(ii) = dtpDate1.Value
dteDays(ii).AddDays(i)
ii = ii + 1
dteDays is an array of dates, starting with dtpDate1
The value of dtpDate1 is 3/31/06
The code above is in a For/Next loop.
i is 0 through some number, we'll say 3 for this example.
No matter what the value of i is, all of the dates in the array, dteDays, are equal to 3/31/06.
what am i doing wrong?
Thanks in advance!!!
Last edited by Hack; Mar 31st, 2006 at 09:32 AM.
Reason: Added green resolved checkmark
-
Mar 31st, 2006, 09:13 AM
#2
Re: Adding day(s) to a date : S
AddDays and the other similar methods do not change the value of the Date object they are called on. They return a new Date object with the new value. To change the existing Date object you'd have to do something like this:
VB Code:
myDate = myDate.AddDays(1)
-
Mar 31st, 2006, 09:17 AM
#3
Thread Starter
Hyperactive Member
Re: Adding day(s) to a date : S
you beat me! i just figured that out...i did thisi nstead:
Code:
dteDays(ii) = dtpDate1.Value.AddDays(i)
ii = ii + 1
and it works perfectly...thanks!
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
|