TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Waqas Ali
NA
19
27.7k
C# Code for making a traffic Light System ???
Jun 28 2012 8:29 AM
Hello Everyone,
I am new to C# so am having trouble making a Traffic Lights System. I have used three timers and a button. When I press the button the RedTimer starts but the program just stops working after that, the red light remains lit and the other one's don't start( it does respond ) . This is the code for my three timers and each timer has an interval of 1000 ms. Can anyone tell me why this is happening ???
This is the code:
private
void
buttonStart_Click(
object
sender, EventArgs e)
{
timerRed.Start();
}
private
void
timerRed_Tick(
object
sender, EventArgs e)
{
timerGreen.Stop(); redLight.FillColor = Color.Red; greenLight.FillColor = Color.Black; timerRed.Stop(); timerYellow.Start();
}
private
void
timerYellow_Tick(
object
sender, EventArgs e)
{
timerRed.Stop(); yellowLight.FillColor = Color.Yellow; redLight.FillColor = Color.Black; timerYellow.Stop(); timerGreen.Start();
}
private
void
timerGreen_Tick(
object
sender, EventArgs e)
{
timerGreen.Stop(); greenLight.FillColor = Color.Green; yellowLight.FillColor = Color.Black; timerGreen.Stop(); timerRed.Start();
}
Reply
Answers (
2
)
Two groups in CrystalReport - embeded groups
asp.net