Creating Long Delays

Question:
I’ve been trying to create a simulator – it requires as close to real-time operation as possible. I have a couple of questions about timers.

  1. How do I activate a timer for more then 60 seconds?
  2. Will DoEvents be good enough to make sure all the other proceduresare working? There could be more then one “delayed” record in one time.Help will be highly appreciated!

    Answer:
    To create a timer that lasts 60 seconds, in the Timer_Timer event, keep a counter of how many 60 second intervals have taken place. Once the counter reaches 5, for instance, do your regular code. That would let you time a five minute interval, for instance. Make sure you reset the counter when you reach the intended count.

    DoEvents tells VB to process the event queue. Make sure you have them in any long-running loops. If you’re using a timer, VB considers that code idle and can process other code at the same time. DoEvents is useful if you are using a busy loop or are processing lots of records in a loop. A DoEvents in between will let the interface refresh occasionally. Supposedly, VB 4.0 and Windows 95 don’t need the DoEvents; however, I have found that without them, the user interface does not refresh at all in some cases.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS

homes in the real estate industry

Exploring the Latest Tech Trends Impacting the Real Estate Industry

The real estate industry is changing thanks to the newest technological advancements. These new developments — from blockchain and AI to virtual reality and 3D printing — are poised to change how we buy and sell homes. Real estate brokers, buyers, sellers, wholesale real estate professionals, fix and flippers, and beyond may