It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Partner Sites
Board index Programming Visual Basic Forum

Timer - Newbie!

Moderator: dafunkymunky

Timer - Newbie!

Postby mesmerized on Wed May 04, 2005 11:37 am

Hey people I have been asked to do a counter/timer with two command buttons one for counting up and one for counting down also a menu with different time intervals. As far as I know I have done the menu bit but stuck on the timer code.

I have two command buttons and I have set a varible called blnCountDown as a boolean. In cmd_CountUp i have set the variable to False and in cmd_CountDown i have set the variable to true.
This is the code for me timer:

Private Sub tmrTimerOne_Timer()
Total = txtDisplay.Text
If blnCountDown = True Then
Total = Total - 1
Else
Total = Total + 1 'but on this line i have an error wen i run it and it sats mismatch...can u help!
End If
txtDisplay.Text = Total

End Sub

Any help would be gr8 iam kinda new to this!
mesmerized
 
Posts: 0
Joined: Wed May 04, 2005 11:32 am

Postby dafunkymunky on Thu May 05, 2005 10:37 am

hi mesmerized

this is the problem

when you give Total = txtDisplay.Text
total is assigned the string value of the text box
to get the numerical value of the text box the command is

Total = Val(txtDisplay.Text )

now you can add or subtract from total

this should work in case you get the solution dont forget to make the topic as solved the soilved tag can be found at the bottom of the posts..

--DAFUNKYMUNKY
--------DAFUNKYMUNKY--------
::THE::NECESSARY::[D]EVIL::
....errr i mean munky....
User avatar
dafunkymunky
100+ Club
 
Posts: 182
Joined: Fri Apr 08, 2005 8:32 am
Location: India


Return to Visual Basic Forum

Who is online

Users browsing this forum: No registered users and 0 guests