|
-
May 29th, 2000, 10:52 PM
#1
Thread Starter
Hyperactive Member
Ok lets say in label1.caption i have the time
1:30:34
now i have 3 more labels
label2.caption
label3.caption
label4.caption
I was label2.caption to read the 1
label3.caption to read the 30
and label label4.caption to read the 34
So another words to be able to split the time apart in label1 into the 3 other labels....hours, minutes, and seconds......got me?
If you can help leave a post...thanks!
-RaY
VB .Net 2010 (Ultimate)
-
May 29th, 2000, 11:07 PM
#2
Addicted Member
Hi,
if that's what I'am thinking, use the Hour, Minute, Second functions to get each parts separed like this :
Label2.caption = hour(label1.caption)
...
The time format of label 1 MUST be compatible with the time format of your PC for these functions to work OK.
-
May 29th, 2000, 11:10 PM
#3
Fanatic Member
Code:
Public Sub SplitTime()
Label1 = Format(Time,"hh:mm:ss")
Label2 = Mid(Label1,1,2)
Label3 = Mid(Label1,4,2)
Label4 = Mid(Label1,7,2)
End Sub
Vince has a better one...
[Edited by r0ach on 05-30-2000 at 06:11 PM]
r0ach™
Don't forget to rate the post
-
May 29th, 2000, 11:15 PM
#4
Thread Starter
Hyperactive Member
That wont work because
This would not work because the time in label1.caption is not the actual time.....its a timer that is set to 2 hours and then counts down automatically before it goes back to form1...... So i need to be able to read the caption itself.
-RaY
VB .Net 2010 (Ultimate)
-
May 29th, 2000, 11:16 PM
#5
_______
One Way
Private Sub Command1_Click()
'I've used 4,3,2,1 as labels
Dim one, two, three, sTime As String
sTime = Time
Label4.Caption = Format(sTime, HH)
one = Left(Time, 2)
two = Mid(Time, 4, 2)
three = Mid(Time, 7, 2)
one = Format(one, "00")
two = Format(two, "00")
three = Format(three, "00")
Label1.Caption = one
Label2.Caption = two
Label3.Caption = three
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
May 29th, 2000, 11:20 PM
#6
Addicted Member
it will work because the display format 1:30:30, 1:30:29...
is a valid time format on your PC.
If it doesn't work, put it in a temporairy datetime variable
then use the functions.
I did not tested this but I'am quite sure it work great...
-
May 29th, 2000, 11:32 PM
#7
Thread Starter
Hyperactive Member
Thanks guys
Thanks everyone, Vince I would give that code a try as soon as i get off work...Thanks a lot man!
-RaY
VB .Net 2010 (Ultimate)
-
May 30th, 2000, 04:50 AM
#8
Thread Starter
Hyperactive Member
IT works vince
-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
|