You are not logged in.

mikethedj4

Beginner

  • "mikethedj4" is male
  • "mikethedj4" started this thread

Posts: 12

Date of registration: Mar 24th 2010

Location: Rockford, IL

Occupation: Freelancer, Inventor

Hobbies: Programming, Design, Engineering, Dancing, and anything else I find to be fun...

  • Send private message

1

Sunday, June 27th 2010, 10:18am

Help on Stopwatch

I have 2 buttons, and 4 labels, now the buttons work fine, and do what their supposed to, but as for the labels the stopwatch is supposed to work like it's supposed to (Example I made in Javascript) once it passes 99 it's supposed to go and have 1 second on the second label, and so on as you saw from the web app I made, but instead the number keeps going higher like so - 326.0

Here's the code I have in Timer1_Timer

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Timer1.Interval = 10
Label4.Caption = Val(Label4.Caption) + Val(1)
If Label4.Caption = 60 Then
Label3.Caption = Val(Label3.Caption) + Val(1)
Label2.Caption = "0"
If Label3.Caption = 60 Then
Label2.Caption = Val(Label3.Caption) + Val(1)
Label3.Caption = "0"
If Label2.Caption = 60 Then
Label1.Caption = Val(Label3.Caption) + Val(1)
Label1.Caption = "0"
End If
End If
End If


Can someone please help me, and tell me what I'm doing wrong???
Be the change you WANT to see in the world!

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

2

Sunday, June 27th 2010, 5:53pm

I think there are a few spelling errors in your code.

Try this:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Public Sub Timer1_Timer()
   Debug.Print Now
   
   Label4.Caption = CInt(Label4.Caption) + 1
   If Label4.Caption = 60 Then
      Label4.Caption = "0"
      Label3.Caption = CInt(Label3.Caption) + 1
      If Label3.Caption = 60 Then
         Label3.Caption = "0"
         Label2.Caption = CInt(Label2.Caption) + 1
         If Label2.Caption = 60 Then
            Label2.Caption = "0"
            Label1.Caption = CInt(Label1.Caption) + 1
         End If
      End If
   End If
End Sub


Greetings

A1880

mikethedj4

Beginner

  • "mikethedj4" is male
  • "mikethedj4" started this thread

Posts: 12

Date of registration: Mar 24th 2010

Location: Rockford, IL

Occupation: Freelancer, Inventor

Hobbies: Programming, Design, Engineering, Dancing, and anything else I find to be fun...

  • Send private message

3

Sunday, June 27th 2010, 9:51pm

Thanks bro I see where I screwed up now, thanks!
Be the change you WANT to see in the world!

Rate this thread
WoltLab Burning Board