Delay an Application Until a Specified Condition is True

Category:
Miscellaneous
Type:
Snippets
Difficulty:
Intermediate
Author:
Intelligent Solutions Inc.

Version Compatibility:

More information:
Often, it is necessary for an application to delay further processing until a specified condition is true. For example, in applications that communicate with remote components (such as Winsock apps), it is usually necessary to wait until the remote component responds before doing anything else. However, you don't want to wait indefinitely -- if there is no response after a specified amount of time, the application must move on.

This routine allows you to implement a delay until a condition is true or a time-out occurs. See the comments for an explanation of how it works.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: