473,387 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

using 2 timers, need to increment and end the loop

Sorry in advance if this has been answered here before. I did my best to search before posting.

I'm working on a boxing timer to use when i hit my heavybag. I have 2 timers going. one to count down the 3minute rounds and one to count down the 1 minute rest inbetween rounds.

both timers have these if statements in them and the timer works great, the only problem is that it just continues on and on forever. since both timers have their own Private sub section i can't figure out where to place the for-next-end statement so that i can increment the round counter and end after the number of rounds I specify. Is there a way to insert those private sub sections?

the project looks like this:

declarations
sub setLabel
sub setLabel
private sub cmdStart_Click <---starts Timer1
private sub frmMain_Load
private sub frmMain_FormClosed
private sub Timer1_Tick <--- counts down 3mins, stops itself, starts Timer2
private sub Timer2_Tick <------counts down 1min, stops itself, starts Timer1
Sep 10 '06 #1
2 2701
Sorry in advance if this has been answered here before. I did my best to search before posting.

I'm working on a boxing timer to use when i hit my heavybag. I have 2 timers going. one to count down the 3minute rounds and one to count down the 1 minute rest inbetween rounds.

both timers have these if statements in them and the timer works great, the only problem is that it just continues on and on forever. since both timers have their own Private sub section i can't figure out where to place the for-next-end statement so that i can increment the round counter and end after the number of rounds I specify. Is there a way to insert those private sub sections?

the project looks like this:

declarations
sub setLabel
sub setLabel
private sub cmdStart_Click <---starts Timer1
private sub frmMain_Load
private sub frmMain_FormClosed
private sub Timer1_Tick <--- counts down 3mins, stops itself, starts Timer2
private sub Timer2_Tick <------counts down 1min, stops itself, starts Timer1

Just some thoughts since I am not really experienced at this.

use cmdStart_Click to pop up an inputbox

Rounds = Inputbox("Enter # Of Rounds. ")

then run a loop based on # of rounds.

for i = 1 to Rounds

call timer1_tick
' have timer one call timer 2 but remove the callback to timer 1 from timer 2 sub
' Timer 1 will start again with the next loop

next i

*** note *** code is untested, but should point you in the right direction.


HTH

Ken
Sep 11 '06 #2
I got it working now, thanks for the advice. I just used if than statments in the timer subs and incremented at the end of one timer.

you can see my boxing timer here
Sep 15 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: nightsaber | last post by:
<script language="JavaScript"> <!-- hide me var the_number = prompt("how many words (3-5 is good)?", "4"); var the_string = ""; var a_word; for (loop = 0; loop < the_number; loop++) {...
4
by: August1 | last post by:
A handful of articles have been posted requesting information on how to use these functions in addition to the time() function as the seed to generate unique groups (sets) of numbers - each group...
23
by: Mark Anderson | last post by:
A 'for' loop takes 3 arguments (initialize; test; increment). The 'test' must equate as true or false This doesn't work... x = 5; for (y=1; (y==5); y+=1) { alert(x * y); } ...nor does... x...
5
by: Iain Miller | last post by:
Trying to get my head round building a DB to analyse phone bills. On the surface its fairly simple - duration in seconds x cost per minute/60. The problem arises with working out what time of...
1
by: Can Balioglu | last post by:
Hi, I don't know if it's already known but I found a bug in System.Timers.Timer class. The 'Interval' property accepts a double which specifies the interval between two 'Elapsed' events. The...
6
by: ransoma22 | last post by:
I developing an application that receive SMS from a connected GSM handphone, e.g Siemens M55, Nokia 6230,etc through the data cable. The application(VB.NET) will receive the SMS automatically,...
2
by: Al | last post by:
I'm currently attempting to use PLink (the console component of PUTTY - see http://www.chiark.greenend.org.uk/~sgtatham/putty/) as a Telnet component as I may in future need to change to using SSH...
13
by: Sunbags | last post by:
Hello, I'm a 2nd year Computer Engineering student and I have a problem with my VB6 code. I've just started learning VB6 for a project in which we have to create a form which displays the...
2
by: taylorcu | last post by:
I'm new to vb.net and i'm building code in vb.net that inputs and outputs CAN-messages in visual studio 2003 with an IFAK CAN driver. I want to make a loop that checks the results of a global...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.