473,414 Members | 1,679 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,414 software developers and data experts.

Traffic light and infinite loop countdown

Pls I have programmed a traffic light on visual basic 6.0 but I cant seem to program the countdown(10-0) to be on infinite loop at every light i.e it should countdown from 10 to 0 before each light shows.
Here is my code
Private Sub Timer2_Timer()
If Label1. Caption = 0 Then
Timer2.Enabled = False
MsgBox ("go")
Else
Label1. Caption = Label1. Caption - 1
End If
End Sub

the countdown continues to 1,-2,-3,-4 and so on but I want it to start from 10 again after counting from 10 to 0..pls how do I put it on endless loop on visual basic 6.0
Thanks.
Jan 26 '22 #1
1 9128
cactusdata
214 Expert 128KB
Reset the Caption to 10:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Timer2_Timer()
  2.  
  3.     If Label1.Caption = 0 Then
  4.         MsgBox ("go")
  5.         Label1.Caption = "10"
  6.     Else
  7.         Label1.Caption = Label1.Caption - 1
  8.     End If
  9.  
  10. End Sub
Jan 29 '22 #2

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

Similar topics

43
by: Gremlin | last post by:
If you are not familiar with the halting problem, I will not go into it in detail but it states that it is impossible to write a program that can tell if a loop is infinite or not. This is a...
0
by: Vedran Vukotic | last post by:
Hello I made the following infinite loop that check's if the bot died and call it again: ------loadloop.pl----- #!/usr/bin/perl use strict; while (1) {
11
by: jojobar | last post by:
I have a aspx file (snippet shown below): ======= <td class="light-m1" id="rwCompleteButton" runat="server"><br/> <asp:ImageButton CssClass="clear-m1" runat="server" CommandName="Complete"...
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...
44
by: James Watt | last post by:
can anyone tell me how to do an infinite loop in C/C++, please ? this is not a homework question .
8
by: razer | last post by:
Hi everybody I'm making a project where i need to make a simulation of a traffic light. The cars appear randomly, and are represented by letter, the traffic light stays open for x seconds, then...
0
by: anusha sharma | last post by:
i have made a visual basic project for traffic light,all the 3 lights are working properly....i need to insert a timer alongwith them,which should decrement each step for specific light.....as soon...
2
by: harryred7 | last post by:
Hi Question- I am currently writing a VB program for a traffic light control system. It nothing too robust nor with any microprocessors/sensors. i am using a Timer to control when the lights...
0
by: initdebug | last post by:
To start, I'm a complete beginner with Computer Vision and I made this project following multiple tutorials. I wanted to create a simple program that would take any input video (in my case, my...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.