Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

VB6 - Timers

Options
  • 09-04-2006 10:13pm
    #1
    Closed Accounts Posts: 307 ✭✭


    Hey all, small question

    Im working with winsock, and Need a timer to send data every 20 seconds, anyone got any ideas how i can make a timer that sends every 20 seconds?


    Thank you kindly,

    ~ Idgeitman


Comments

  • Closed Accounts Posts: 4,943 ✭✭✭Mutant_Fruit


    google search for "vb6 timer control" and you should get some useful hits...


  • Registered Users Posts: 362 ✭✭theone


    have it in a loop and have a thread.sleep(20000) to act as your 20 seconds so it waits 20 seconds before sending the command again.


  • Registered Users Posts: 1,606 ✭✭✭djmarkus


    Just use the timer control! thatd be the easiest IMO


  • Registered Users Posts: 128 ✭✭dowlinj


    Timer Control is what you require. You simply set the interval property of the control to how often you want the particular event to occur. When the interval passes, the timer control triggers the event procedure that you have set up to handle the timer event. It's no more complicated than that.


  • Registered Users Posts: 362 ✭✭theone


    easier putting a thread.sleep() in imo


  • Advertisement
  • Registered Users Posts: 128 ✭✭dowlinj


    I may be wrong here, but I'm not sure if there's such a thing as threads in vb 6. I know there's a win32 api called SLEEP which can be used to the same effect though. I've always used the timer control for this purpose. Saves messing with the win32 api functions.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    theone wrote:
    easier putting a thread.sleep() in imo
    And when someone asks the same question for VB.Net and not VB6 then you'll actually be right.
    dowlinj wrote:
    I may be wrong here, but I'm not sure if there's such a thing as threads in vb 6.
    Implementing threads in VB5 or 6 is a bitch. Which makes any app written in either and that uses Winsock pretty limited.


  • Registered Users Posts: 21,611 ✭✭✭✭Sam Vimes


    easiest way. just add a timer control and set the interval in milliseconds.


  • Closed Accounts Posts: 307 ✭✭Idgeitman


    hey thanks for all the help =)


    ~ Idgeitman


Advertisement