How do i get a running stop watch in vb

G

Guest

Please could you help me.
I just want to display a timer constantly running and being displayed in vb
say in a textbox.
I want to use it to action at certain points via various variables and
actions.
The timer function starts off the clock at the current time and if i stop
the clock i can minus finish time from start time but that would mean
stopping it every time just to display result i want it displayed so it would
be constantly running and updating like a typical countdown or countup. All i
want is a timer starting at 00:00 and keep running throughout at bottom of
screen and everything can just carry on running and referenfing to it
occasionally.

for example a program say where the msg says "You have 5 seconds to hit the
button"
it counts done from 5 or up from 0 in a box at bottom of screen until the
person presses it or fails if time runs out
thanks
john
 
M

Michael Bauer

Am Thu, 27 Apr 2006 17:04:02 -0700 schrieb pallytruck:

Here´s a sample for an API timer:
http://www.vboffice.net/sample.html?mnu=2&smp=4&cmd=showitem

Please scroll down and copy the code for the module "modTimer.bas". You can
then add an UserForm to your project with that textbox and an Ok and Cancel
button. The Form will need a public method named Timer, which will be called
by the timer.

You can launch that UserForm and start the timer with
modTimer.EnableTimer 1000
That means the timer fires once per second. In the UserForm´s Timer method
update the box, call DoEvents and check if the User has pressed a button.
Additioinally count the events being fired. After 5 events or if a button
was pressed stop the timer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top