Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 18th, 2005, 7:55 PM   #1
skylinegtr
Newbie
 
Join Date: Oct 2004
Posts: 9
Rep Power: 0 skylinegtr is on a distinguished road
Red face Two Timers Problem

I have no idea why this code won't work could you please help. Thanks



Private Sub Form_Load()
    Label1.Caption = 100
    Timer1.Enabled = True
End Sub

Private Sub Timer2Start()
    
    Timer2.Enabled = True
    
    Do
        If Label1.Caption = 100 Then
            Exit Do
        End If
    Loop
    
    
End Sub

Private Sub Timer1_Timer()
    Label1.Caption = Label1.Caption - 1
    If Label1.Caption = 0 Then
        Timer1.Enabled = False
        Timer2Start
    End If
    
End Sub

Private Sub Timer2_Timer()
    Label1.Caption = Label1.Caption + 1
End Sub

Last edited by skylinegtr; Jan 18th, 2005 at 8:02 PM.
skylinegtr is offline   Reply With Quote
Old Jan 18th, 2005, 8:02 PM   #2
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
The loop's taking up so many resources, Windows can't update the form. Make it:
Do
    If Label1.Caption = 100 Then
        Exit Do
    End If
    DoEvents
Loop
DoEvents tells the computer to get on with background stuff before it moves on.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Jan 18th, 2005, 8:03 PM   #3
skylinegtr
Newbie
 
Join Date: Oct 2004
Posts: 9
Rep Power: 0 skylinegtr is on a distinguished road
thanks for your quick reply
skylinegtr is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:08 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC