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

Thread: Timer (loop)

Threaded View

  1. #1
    Join Date
    Mar 2004
    Posts
    13

    Timer (loop) [RESOLVED]

    Hi,

    I'm trying to make a program do X every 30 seconds. My timer only fires once. Here's my code:


    (in Declarations)
    Code:
    Option Explicit
    Dim Counter As Integer
    (in Form Load)
    Code:
    Timer1.Enabled = True
    Timer1.Interval = 1000
    Counter = "0"
    And my sub:
    Code:
    Private Sub Timer1_Timer()
    Counter = Counter + 1
    If Counter = 30 Then
        MsgBox "30 seconds has passed"
    
    End If
    End Sub
    I've tried changing things around a bit, and I've tried putting Timer1.Enabled=False followed by Timer1.Enabled=True after the MsgBox.

    What's wrong?

    Thanks.
    Last edited by rehto; March 22nd, 2004 at 05:08 PM.

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