|
-
Mar 11th, 2004, 03:57 PM
#1
Thread Starter
Fanatic Member
Damn time variable.... *RESOLVED*
Hey peeps.
I've just moved from VB6, and it seems half the standard variables don't work anymore!!!
I'm trying to format the contents of a textbox to time format, like this...
textbox.text = format(time, "h:mm")
and all I get is "time not declared"....
Any ideas, cause i'm not firing on all cylinders 2nite
Last edited by VisionIT; Mar 11th, 2004 at 05:40 PM.
-
Mar 11th, 2004, 04:49 PM
#2
Hyperactive Member
Try this..
TextBox.Text=Format(Now, "hh:mm")
HTH
-
Mar 11th, 2004, 04:50 PM
#3
Thread Starter
Fanatic Member
Thanx... but i've tried that, and all it does it put the time in the text box 
I'm really confused!
Say I have "21.5" in the text box, which obviously makes no sense like that, so I need it to read as "21 hours 30 minutes" etc etc
Thanx
-
Mar 11th, 2004, 05:21 PM
#4
Hyperactive Member
Ahh, I see what your're trying to do.
Try this one.
(I am using a constant as the time but you can cdbl(Textbox.Text))
Code:
Const cTime As Double = 21.5
Dim ts As New TimeSpan
Dim t As DateTime
Dim sTime As New System.Text.StringBuilder
t = ts.FromHours(cTime).ToString
sTime.Append(t.Hour & " Hours ")
sTime.Append(t.Minute & " Minutes ")
TextBox1.Text = sTime.ToString
-
Mar 11th, 2004, 05:40 PM
#5
Thread Starter
Fanatic Member
That works nicely, cheers.
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
|