|
-
Jun 12th, 2002, 12:33 AM
#1
Thread Starter
Hyperactive Member
Problems with the Format function
I know this is a noob question but here goes:
Here is a snippit of code:
millsec = millsec + 1
lblMilli.Text = millsec
lblSeconds.Text = Format(millsec / 1000, "##")
This code is inside a timer control with an interval of 1. As you can see, I'm trying to convert milliseconds to seconds by dividing
millsec (which represents the number of milliseconds which have gone by) by 1000. I then try to format this number to only have two digits using the format function. Instead of having the seconds field go up one every 1000 millisecond it goes up one every 500 milliseconds. I get rid of the formating and everything works (with all the decimal places). I'm using an integer data type for millsec. I hope this isn't too much. Any help appreciated.
-
Jun 12th, 2002, 12:53 AM
#2
PowerPoster
Why not just set the timer .Interval to 1000, to make it tick over every second?
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Jun 12th, 2002, 01:06 AM
#3
Thread Starter
Hyperactive Member
I'm a moron, always trying to do everything the hard way. Thanks, i'll try that.
-
Jun 12th, 2002, 01:10 AM
#4
PowerPoster
Originally posted by Comreak
I'm a moron, always trying to do everything the hard way. Thanks, i'll try that.
Moron = Someone who comes to the forum asking for help making a virus.
Newbie = Someone who comes to the forum asking how to format milliseconds in a timer when there's an easier way.
newbie doesn't necessarily equal moron.
-
Jun 13th, 2002, 02:46 AM
#5
Thread Starter
Hyperactive Member
I suppose I'd rather be a newbie instead of a moron. I origonally wanted to show the passage of milliseconds, not just seconds. I still need a way to format milliseconds.
-
Jun 13th, 2002, 03:11 AM
#6
New Member
hi
may be this will help out
Dim millSec As Integer
Private Sub Timer1_Timer()
millSec = millSec + 1
Text1.Text = Format(millSec / 1000, ".###")
End Sub
u have 2 change the format which i have given u
best of luck
b bye
Rishi Bhutani
-
Jun 13th, 2002, 03:12 AM
#7
She's in Budapest now...
VB Code:
lblSeconds.Text = Format(MilliSecs / 1000, "0.00#")
You mean like that?
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
|