Enforce a Timeout Using the Timer Function
The snippet is a simpler and more robust implementation of the delay routine on this site. In the other example, you pass a timeout value and a boolean value by reference and return after the boolean value is true or timeout span is exceeded; therefore, the boolean value must be available at the module or global level. In this example, you just pass the time to wait before timing out.
See the comments within the code for more information and an example.
Instructions: Copy the declarations and code below and paste directly into your VB project.