Tip Bank

DevX - Software Development Resource

Use DataChanged with unbound controls

When you need to learn if a field has been changed by the user, you have at least three options: you can use a global boolean variable and set it

DevX - Software Development Resource

Property Procedures in BAS modules

Visual Basic supports Property procedures to implement properties in your own CLS and FRM modules. However, it turns out that you can use Property procedures even within BAS code modules.

DevX - Software Development Resource

Benchmarks with millisecond accuracy

The Timer function returns a value which is only accurate to about 55 milliseconds, therefore it is not very useful for doing accurate benchmarks. If you need a better resolution

DevX - Software Development Resource

Create a GUID

When you build your ActiveX controls and components, Visual Basic automatically creates all the GUIDs as necessary. The same also happens in other cases, without you even realizing it: for

DevX - Software Development Resource

Enhanced For-Next loops

At times you may need to execute the same block of statements for different values of a variable, but you can’t use a straight For Next loop because the sequence

DevX - Software Development Resource

Missing Option Explicit directives

The single statement that is most useful to avoid bugs is Option Explicit. Always use it in every module of your applications. Even better, let the Visual Basic IDE automatically

DevX - Software Development Resource

Overwrite mode for textbox controls

By default, textbox controls work in insert mode, where each new character never overwrites existing ones. If you wish to implement overwrite mode you can take advantage of the fact