how does timer work in vb.net 2003?

hi!
   say i want to display the first label on a form and after a few seconds, the second label will display. what should be the code

thanks,
mac


Answer this question

how does timer work in vb.net 2003?

  • AnandaK

    great ! it works Paul...Smile


    thanks,
    mac

  • RajALDC

    hi remco,

    there were build error saying "the event elapsed could not be found".

    i've tried this code and works;

    label1.text = now

    but ofcourse label1 will display both the current date and time. my question is how to display only the system time

    thanks,
    mac

  • gicio

    hi,

    in vb6, the way i displayed the system clock on a form is like this;

    Timer 1 Interval = 10

    Private Sub Timer1_Timer ()
    Label1.caption = Time
    End Sub

    this code desn't work in vb.net 2003. what has changed

    thanks,
    mac

  • Sven Rutten

    Which error exactly
  • Kevin Downward

    Hi,

    I've tried this in VB2005 im not quite sure if this would work in 2003. But just give it a try.

    label1.Text = Now.ToString("hh:mm")

     

     

    cheers,

    Paul June A. Domag



  • Omid Bayani

    hi,

    i've got an error for the Timer1.Elapsed.

    thanks,
    mac

  • Anson Horton

    Some time ago i explained it to someone with a simmular question

    Like so

    Assuming you have a form called 'form1' a Timer called 'timer1'and a label called 'label1'



    Form variable
    Private _strArray(4) As String


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    _strArray(0) = "aaaaaa"
    _strArray(1) = "bbbbbb"
    _strArray(2) = "cccccc"
    _strArray(3) = "dddddd"
    _strArray(4) = "eeeeee"

    End Sub

    Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed
    Static INDEX As Integer 

       Label1.Text = _strArray(INDEX) 

       If INDEX = (UBound(_strArray) - 1) Then 
          INDEX = 0 
       Else 
          INDEX += 1 
       End If

    End Sub

     


    For some reason could not find it over here anymore , so I pulled it from a google cache


    Remco

  • Olivier Jooris

    Hi,

    A timer is like a clock. You could set the time on which the code in its tick event would execute. You can control the time by setting its Interval property (its in milliseconds)...

     

     

    cheers,

    Paul June A. Domag



  • Paul Laudeman

    Hi,

    It is similar in VB.net. Here are the steps:

    1. Set the Interval property of the Timer in the Design.
    2. Double Click the Timer to create the Tick() event. Place whatever you want on the tick() event...

     

     

    cheers,

    Paul June A. Domag



  • how does timer work in vb.net 2003?