|
-
June 12th, 2001, 03:49 PM
#1
[RESOLVED] visual basic and the clock
I'm looking for a way to make a stopwatch or something similar in visual basic. the problem is I want to be able to run it in the background, but if I do that using a timer, the time goes off because of a lower priority. any thoughts? perhaps tie it to the system clock?
-
June 12th, 2001, 04:14 PM
#2
Isaac--I'm writing a stopwatch right now <IMG SRC="smilies/biggrin.gif" border="0"> <IMG SRC="smilies/biggrin.gif" border="0"> Something to run on my new laptop for Newsbreak, so I don't have to wrestle with all those timers <IMG SRC="smilies/wink.gif" border="0">. I think I'm having a similar problem as you are--it gets off by about three seconds every minute. I'm afraid when I transfer it to my laptop, which is a slower machine, it'll get off by even more. E-mail me if you wanna compare notes; and if anybody has any ideas I could use them <IMG SRC="smilies/smile.gif" border="0">
<a href="http://www.8ung.at/furlong47" target="_blank">Furlong47's Poetry Page</a>
<a href="http://roadtrip.d-domains.net" target="_blank">ROADTRIP!!!</a>
You know it's going to be a long day when you get up, shave and shower, start to get dressed and your shoes are still warm. -- Dean Webber
-
June 12th, 2001, 10:23 PM
#3
Why aren't use using the system clock?
Just curious...
-
June 13th, 2001, 06:26 AM
#4
Originally posted by opiate:
<STRONG>Why aren't use using the system clock?
Just curious...</STRONG>
very simply because I don't know how...I've only had an introductory level class in visual basic and we didn't cover that. I wasn't sure if it was possible; you seem to have answered that. NOw I just have to go figure out how ;-)
-
June 13th, 2001, 07:03 AM
#5
Here's an example routine.
You need to fill in your bits between the two, or chop it up into functions so that you can trigger the Start and Stop, for example using the _OnClick events of a button.
Code:
dim dtmStart as Date
dim dtmStop as Date
dim sDelay as String
dtmStart = Now()
... do stuff ...
dtmStop = Now()
sDelay = DateDiff("s",dtmStart,dtmStop)
MsgBox "That took " & sDelay & " seconds."
This routine uses the DateDiff function to format the difference between two date objects.
The Now() function simply returns a timestamp of the system date and time.
HTH.
-
June 13th, 2001, 10:08 AM
#6
thanks antonye, that does the job!
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
|
|
Bookmarks