6 Replies - 1680 Views - Last Post: 20 January 2008 - 05:44 AM Rate Topic: -----

#1 sam_benne  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 16
  • View blog
  • Posts: 732
  • Joined: 16-January 08

Timer

Post icon  Posted 16 January 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?
Is This A Good Question/Topic? 0
  • +

Replies To: Timer

#2 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5230
  • View blog
  • Posts: 27,015
  • Joined: 10-May 07

Re: Timer

Posted 16 January 2008 - 10:36 AM

View Postsam_benne, on 16 Jan, 2008 - 10:16 AM, said:

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:
Was This Post Helpful? 0
  • +
  • -

#3 sam_benne  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 16
  • View blog
  • Posts: 732
  • Joined: 16-January 08

Re: Timer

Posted 16 January 2008 - 10:48 AM

View Postno2pencil, on 16 Jan, 2008 - 10:36 AM, said:

View Postsam_benne, on 16 Jan, 2008 - 10:16 AM, said:

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:


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.

Private Sub Cmdtimer_Click()
text1.timer
End Sub


Was This Post Helpful? 0
  • +
  • -

#4 Nayana  Icon User is offline

  • DIC Hawk - 나야나 नयन:
  • member icon

Reputation: 31
  • View blog
  • Posts: 824
  • Joined: 14-November 07

Re: Timer

Posted 19 January 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.
Was This Post Helpful? 0
  • +
  • -

#5 sam_benne  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 16
  • View blog
  • Posts: 732
  • Joined: 16-January 08

Re: Timer

Posted 19 January 2008 - 10:40 AM

View PostNayana, on 19 Jan, 2008 - 06:00 AM, said:

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
Private Sub tmrtime_Timer()

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

End Sub


Was This Post Helpful? 0
  • +
  • -

#6 Nayana  Icon User is offline

  • DIC Hawk - 나야나 नयन:
  • member icon

Reputation: 31
  • View blog
  • Posts: 824
  • Joined: 14-November 07

Re: Timer

Posted 20 January 2008 - 03:22 AM

Use the Format command.

For instance, if x = 5.1, then Format(x, "00.00") = "05.10"
Was This Post Helpful? 0
  • +
  • -

#7 benpap  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 6
  • View blog
  • Posts: 47
  • Joined: 24-November 07

Re: Timer

Posted 20 January 2008 - 05:44 AM

have a look at this tutorial it should help :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1