Visual basic question

  • Thread starter nick227
  • Start date
  • #1
36
0

Main Question or Discussion Point

Hey all. I am working on this program that will light LEDs from the parallel port of my computer. I think i have everything all set, but i want to do something cool. I was thinking of alternating lights between three colors. i am new to VB (and programming in general) and was wondering if there was a way to factor time into alternating the lights. Can i somehow make a method or some sort of loop that lets me run one set of lights for say 5 seconds or any amount of time then move on to the next set of lights? Basically, how do i factor in time?

Also, if i can do this with VB, can i do it with java? say i want to have a message appear for 10 seconds, then disappear and have another message appear for 10 seconds?
 

Answers and Replies

  • #2
DaveC426913
Gold Member
18,338
1,941
Hey all. I am working on this program that will light LEDs from the parallel port of my computer. I think i have everything all set, but i want to do something cool. I was thinking of alternating lights between three colors. i am new to VB (and programming in general) and was wondering if there was a way to factor time into alternating the lights. Can i somehow make a method or some sort of loop that lets me run one set of lights for say 5 seconds or any amount of time then move on to the next set of lights? Basically, how do i factor in time?
Certainly. Look at the VB Timer control. You drag it onto your page and set its properties (look at the interval property) and turn it on and it will fire each interval.

In Java, you won't have it all wrapped up in a control, but you will have access to Time functions. You'd store the current Time, and test it using a loop. When the old and current time are the appropraite number apart, you trigger your action. (You can do it the same way in VB too.)
 

Related Threads for: Visual basic question

  • Last Post
Replies
2
Views
2K
Replies
5
Views
6K
  • Last Post
Replies
1
Views
3K
  • Last Post
Replies
2
Views
3K
  • Last Post
Replies
13
Views
3K
  • Last Post
Replies
4
Views
2K
  • Last Post
Replies
1
Views
447
  • Last Post
Replies
3
Views
1K
Top