Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Visual Basic (http://www.programmingforums.org/forum18.html)
-   -   Adding to a date variable? (http://www.programmingforums.org/showthread.php?t=13069)

Emperor Apr 26th, 2007 5:55 PM

Adding to a date variable?
 
Hey guys, basically what I have is a date variable in the following format: mm/dd/yyyy and I'm trying to allow the user to add either days, months or years to this date by typing the following into a text box: 5 Days or 10 Months or 20 Years etc etc etc. Basically a number then a space then what they're adding(Days, Months, or Years).

I'm having trouble figuring out how to make it so it reads the number part and just takes that and adds it to a specified field in the date. Could anyone help me on this? Thanks.

physicist May 11th, 2007 12:11 AM

set an integer = to each component of the date,
then on Text1_Changed sub procedure
have it so that it takes the val(text1.text) and sets that to another variable, having it take the val of the string entered into the textbox takes only the number part provided they typed like 12 months and not like 12 mon23432ths343242 and then read the string for "month, day, year" store the last part of string (the "month" "day" or "year") to a variable and do a select case
case "month"
store numeric variable (the val(text1.text)) in place of month
and so on....


All times are GMT -5. The time now is 11:19 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC