|
-
Jun 1st, 2000, 08:30 PM
#1
Thread Starter
Hyperactive Member
The following code takes the time from text1.text and text2.text and adds them up and places the new time in text3.text....it even notices that if minutes are more then 60 to add it to the hour section....now i need this code to do the same with the seconds.....so instead of 2:30 and 2:30 equals 5:00 I need 2:30:30 and 2:30:30 which would equal 5:01...got me? Heres the code
a=timevalue(text1)
b=timevalue(text2)
c=minute(a)
d=minute(b)
text3=hour(a)+hour _(b)& ":" & c + d
if (c+d) >=60 then
m=(hour(a) + hour _(b) + 1)
n=(c+d)-60
text3=m & ":" & n
End if
In the form load event add the following code:
Text1="2:30"
Text2="3:30"
-RaY
VB .Net 2010 (Ultimate)
-
Jun 1st, 2000, 10:40 PM
#2
Thread Starter
Hyperactive Member
I get a error
Expected: New or Interger or Long Or Single Or Double Or Currency or String or Varient or identifer.
and on the first line it highlightes the last "Date"
Dim Date1, Date2 As Date <---
-RaY
VB .Net 2010 (Ultimate)
-
Jun 2nd, 2000, 12:01 AM
#3
PowerPoster
TimeValue Function
You only need the TimeValue function to do it.
Assume:
- T1 is the text from Text1
- T2 is the text from Text2
- T3 is the result to Text3
Code:
Dim T1$, T2$, T3$
T1 = "2:30:30"
T2 = "3:30:30"
T3 = Format(TimeValue(T1) + TimeValue(T2), "HH:MM:SS")

-
Jun 4th, 2000, 09:59 PM
#4
Thread Starter
Hyperactive Member
Thanks a lot
Dood, that one hit the spot. Thanks a lot, i been going crazy with the code i had.
-RaY
VB .Net 2010 (Ultimate)
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
|