CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Timer In VB

  1. #1
    Join Date
    Mar 2001
    Posts
    26

    Timer In VB

    Hi All

    I want to use timer in a VB program, but i don't know how I can use it.

    Could someone pls help me?

    Thanks

    Ehsan


  2. #2
    Join Date
    May 2001
    Location
    India
    Posts
    9

    Re: Timer In VB

    select timer and press F1 man ! dont u know such a simple thing :-)

    Regards,
    Vinod

  3. #3
    Join Date
    Mar 2000
    Posts
    95

    Re: Timer In VB



    'Place a timer control, 2 command buttons and
    'a textbox on a form, use default names. then
    'do something like this

    Dim counter as Long

    private Sub Form_Load()
    Timer1.Enabled = false
    Timer1.Interval = 1000 '1 sec
    End Sub
    private Sub Command1_Click()
    If Timer1.Enabled = false then
    Timer1.Enabled = true
    End If
    counter = 0
    End Sub

    private Sub Command2_Click()
    If Timer1.Enabled = true then
    Timer1.Enabled = false
    End If
    End Sub

    private Sub Form_Load()
    Timer1.Interval = 1000 '1 sec
    End Sub


    private Sub Timer1_Timer()
    counter = counter + 1
    Text1.Text = counter
    End Sub





    Curt



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured