Results 1 to 10 of 10

Thread: [RESOLVED] Setting a timer for ActiveX User control button to calculate pulse

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2005
    Posts
    105

    Resolved [RESOLVED] Setting a timer for ActiveX User control button to calculate pulse

    Hi,
    Does anyone know how to program a timer set to 0-500ms that will start counting when a button is pressed down, therefore executing the code for that button. After 500miliseconds the button will switch off and the timer would reset again and be ready for the next button to be pressed. If the timer has already started by pressing one button and has not finished to 500ms and another button is pressed, would like it to interrupt the timer and reset it again.

    If anyone could help me, would be much appreciated.

  2. #2
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Setting a timer for ActiveX User control button to calculate pulse

    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2005
    Posts
    105

    Talking Re: Setting a timer for ActiveX User control button to calculate pulse

    Hi Dave,
    With the code you created, how do i display the timer's time on a form?
    And I tried setting it up as well, but got a compile error with the following line:
    VB Code:
    1. Private WithEvents m_Timer As CountDownTimer
    Maybe Im setting it up wrong, please advise..
    thanks alot

  4. #4
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Setting a timer for ActiveX User control button to calculate pulse

    It won't show the time as it's counting down. It just raises friendly Events.
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  5. #5
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Setting a timer for ActiveX User control button to calculate pulse

    The code I posted - it needs to be in a Class module.
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Sep 2005
    Posts
    105

    Re: Setting a timer for ActiveX User control button to calculate pulse

    Quote Originally Posted by Dave Sell
    The code I posted - it needs to be in a Class module.
    Yup have put it in a class module same error.

    What do you put on the form? Is it 2 buttons and a timer?

  7. #7
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Setting a timer for ActiveX User control button to calculate pulse

    2 Buttons, named:

    - cmdIncrement
    - cmdIncrement10

    The top of the form should have:

    VB Code:
    1. Option Explicit
    2. '
    3. Private WithEvents m_Timer As CountDownTimer
    4. '

    There is ni timer on the form.
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Sep 2005
    Posts
    105

    Re: Setting a timer for User control button to calculate pulse

    Hey Dave,

    Have setup a form that has your code with your instructions and it still has the same error. Have attached it for you to have a look
    Attached Files Attached Files

  9. #9
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Setting a timer for User control button to calculate pulse

    Quote Originally Posted by potatocake
    Hey Dave,

    Have setup a form that has your code with your instructions and it still has the same error. Have attached it for you to have a look
    Ya you need to name the class module, CountDownTimer
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Sep 2005
    Posts
    105

    Re: Setting a timer for ActiveX User control button to calculate pulse

    Opps sorry,
    Have named the Class module as that now thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width