Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Software Development Software Development
Search Search
Search for:
Tech Support Guy > > >

[vb] Do until a button is clicked?


(!)

fongweibin's Avatar
fongweibin fongweibin is offline
Junior Member with 1 posts.
THREAD STARTER
 
Join Date: May 2011
Experience: Beginner
04-May-2011, 11:14 PM #1
[vb] Do until a button is clicked?
hi there im a beginner in vb, im doing a traffic light system right now. i have build the code, but don't know how to loop the whole thing. The condition is like the following:
-There are three traffic lights, each goes and another follows after the previous one turns red.
-im now trying "do until (exitbutton.selected)" ..."loop" ---> doesnt return a value, i know there is a mistake here
the loop should continue running until user click on the exit button.
anyone can help me? im using a timer by the way, and i have declared the variable "count" to count the timer. should i add "count = 0" at the last part of the loop in order to let the count starts from zero again?

sorry i know ive explained quite poorly. Please feel free to ask more thank you
DaBeers's Avatar
DaBeers DaBeers is offline
Computer Specs
Member with 276 posts.
 
Join Date: Oct 2008
Location: La Crosse, WI
Experience: Intermediate
05-May-2011, 05:22 AM #2
There are just a few things you need to do to make a timer work.

Drop a timer on the form.

Set the increment.
Code:

Timer1.Interval = 100
(1000 = 1 second)

Tell it to start.
Code:

Timer1.Start()
Then you can use the Timer1.Ticks event to run code at your selected interval.

GL
centauricw's Avatar
centauricw centauricw is offline
Member with 435 posts.
 
Join Date: Jun 2010
Location: Atlanta GA
Experience: Advanced
08-May-2011, 04:35 AM #3
You should be using the Button.Click event to capture the exit button click. It can then set a variable to show the exit button has been clicked. You watch this variable in your loop and exit the loop when the variable is set.
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑