Welcome to Dream.In.Code
Become a VB Expert!

Join 149,934 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,627 people online right now. Registration is fast and FREE... Join Now!




Timer

 
Reply to this topicStart new topic

Timer, Timer

sam_benne
16 Jan, 2008 - 09:16 AM
Post #1

D.I.C Regular
Group Icon

Joined: 16 Jan, 2008
Posts: 368



Thanked: 2 times
Dream Kudos: 400
My Contributions
Hi, I have a problem creating a timer but it goes up from 00.00 to 99.99 in a text box. It would start as i click a button and stop when i let go. Can anybody help me please?
User is offlineProfile CardPM
+Quote Post

no2pencil
RE: Timer
16 Jan, 2008 - 09:36 AM
Post #2

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 7,143



Thanked: 77 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
QUOTE(sam_benne @ 16 Jan, 2008 - 10:16 AM) *

Hi, I have a problem creating a timer but it goes up from 00.00 to 99.99 in a text box. It would start as i click a button and stop when i let go. Can anybody help me please?

It might be a problem with your code. Could you post your code so we can have a look at it? I'm sure someone can help you.

code.gif
User is offlineProfile CardPM
+Quote Post

sam_benne
RE: Timer
16 Jan, 2008 - 09:48 AM
Post #3

D.I.C Regular
Group Icon

Joined: 16 Jan, 2008
Posts: 368



Thanked: 2 times
Dream Kudos: 400
My Contributions
QUOTE(no2pencil @ 16 Jan, 2008 - 10:36 AM) *

QUOTE(sam_benne @ 16 Jan, 2008 - 10:16 AM) *

Hi, I have a problem creating a timer but it goes up from 00.00 to 99.99 in a text box. It would start as i click a button and stop when i let go. Can anybody help me please?

It might be a problem with your code. Could you post your code so we can have a look at it? I'm sure someone can help you.

code.gif


Well i'm not how to do it I was thinking of when I click the button a text box would then become the face of the timer.
This is what I got when trying to do it.

CODE

Private Sub Cmdtimer_Click()
text1.timer
End Sub



User is offlineProfile CardPM
+Quote Post

Nayana
RE: Timer
19 Jan, 2008 - 05:00 AM
Post #4

DIC Hawk - 나야나 नयन:
Group Icon

Joined: 14 Nov, 2007
Posts: 824



Thanked: 5 times
Dream Kudos: 175
My Contributions
You're going to need a button, a text box and a timer.

Set the timer to go off every 1000ms or something

Update the value of the textbox inside the timer.

You can use a 'static' variable to store the value inside the timer.

Try it first, then come back.
User is offlineProfile CardPM
+Quote Post

sam_benne
RE: Timer
19 Jan, 2008 - 09:40 AM
Post #5

D.I.C Regular
Group Icon

Joined: 16 Jan, 2008
Posts: 368



Thanked: 2 times
Dream Kudos: 400
My Contributions
QUOTE(Nayana @ 19 Jan, 2008 - 06:00 AM) *

You're going to need a button, a text box and a timer.

Set the timer to go off every 1000ms or something

Update the value of the textbox inside the timer.

You can use a 'static' variable to store the value inside the timer.

Try it first, then come back.


I have now got my timer working great but i want to improve it because at the moment it basically adds 0.01 and shows it in my text book as 0.01 but i can't get it to show the number as 00.01 as the rest of the program needs it to be like that
CODE

Private Sub tmrtime_Timer()

txtFuel.Text = 0.01 + Val(txtFuel.Text)

End Sub

User is offlineProfile CardPM
+Quote Post

Nayana
RE: Timer
20 Jan, 2008 - 02:22 AM
Post #6

DIC Hawk - 나야나 नयन:
Group Icon

Joined: 14 Nov, 2007
Posts: 824



Thanked: 5 times
Dream Kudos: 175
My Contributions
Use the Format command.

For instance, if x = 5.1, then Format(x, "00.00") = "05.10"

User is offlineProfile CardPM
+Quote Post

benpap
RE: Timer
20 Jan, 2008 - 04:44 AM
Post #7

New D.I.C Head
Group Icon

Joined: 24 Nov, 2007
Posts: 44


Dream Kudos: 100
My Contributions
have a look at this tutorial it should help smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 03:41PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month