LED indicators

ravoll

Well-known member
Joined
Aug 26, 2010
Messages
50
Programming Experience
Beginner
Hi All,

Am currently working and experimenting with VB2008.Looking for some sort of
LED indicator,to put on a form,so I can see when my timer is active.
Any Ideas how to do this,or where I might find code,or even an addon.

Have already tried "google" with no avail
 
Thanks,
Not far enough with VB to create images.
Currently trying to figure out how to use the progress bar.
Want it to fill up as the timer runs and start over for each interval.
 
You don't really need VB to make images... just use MS Paint or Gimp or something.

Then you import it into your project.
 
Vb.NET led indicator lights

Drag and drop a Picture Box control and then add the green and red images into resources. Now add a timer and enable it by default. Double click the Timer and add the following code inside the Tick event.

VB.NET:
        If DateTime.Now.Second Mod 2 Then
            Me.PictureBox1.Image = My.Resources.green
        Else
            Me.PictureBox1.Image = My.Resources.red
        End If

Note: this is a very basic example so you should not expect anything fancy :) demonstration project included!!
 

Attachments

  • LedIndicator.zip
    18.2 KB · Views: 377
Drag and drop a Picture Box control and then add the green and red images into resources. Now add a timer and enable it by default. Double click the Timer and add the following code inside the Tick event.

VB.NET:
        If DateTime.Now.Second Mod 2 Then
            Me.PictureBox1.Image = My.Resources.green
        Else
            Me.PictureBox1.Image = My.Resources.red
        End If

Note: this is a very basic example so you should not expect anything fancy :) demonstration project included!!

OK thanks got it blinking.It starts as soon as the Timerstarts, but does not blink according to the timer interval of 500.
How can I make it blink with the timer interval?
 
Set the Timer's interval to wanted value e.g. 500 milliseconds and then just change the Tick event to this:

VB.NET:
    Private indicator As Long = 0
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        indicator += 1
        If indicator Mod 2 Then
            Me.PictureBox1.Image = My.Resources.green
        Else
            Me.PictureBox1.Image = My.Resources.red
        End If
    End Sub
 
Back
Top