0

Hello,
I am kind of new with vb6 and vb8. I am working on a program that has a countdown timer.
I have the code for the countdown but what I would like to do is to have it when the the countdown is done then the program will shut down. If any one can help please post somthing that is useful to me.

This is the curent code I have:

Private Sub Form_Load()
  Timer1.Interval = 1000
     Label2.Caption = "60"
End Sub

Private Sub Timer1_Timer()
     If Label2.Caption = 0 Then
          Timer1.Enabled = False
          MsgBox ("60 secs is up, looks like your out of luck")
     Else
          Label2.Caption = Label2.Caption - 1
     End If
End Sub
4
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by jireh
0

so...what do you want?
If u want to terminated application just add End statement.

Private Sub Timer1_Timer()
If Label2.Caption = 0 Then
    Timer1.Enabled = False
    MsgBox ("60 secs is up, looks like your out of luck")
    End
Else
    Label2.Caption = Label2.Caption - 1
End If
End Sub
0

its safer to use the VAL() Function

Private Sub Form_Load()  
      Timer1.Interval = 1000     
      Label2.Caption = "60"
End Sub 

Private Sub Timer1_Timer()     
     If [B]Val[/B](Label2.Caption) = 0 Then          
            Timer1.Enabled = False
            MsgBox ("60 secs is up, looks like your out of luck")
            End
     Else          
            Label2.Caption = [B]Val[/B](Label2.Caption) - 1     
     End If
End Sub
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.