How to Use Declaration

Earlier in this chapter I listed a variety of Visual Basic source code components that fell under the wide umbrella of declaration. In our how-to discussion of this topic, we can group these elements into four major areas: variable data declaration, constant data declaration, other declarations, and the order of code within a routine.

Variable Data Declaration

It is possible to write a small, useful Visual Basic application without variables, but such cases are rare. The use of variables are core to real-world Visual Basic applications. Ensuring they are declared correctly bestows on them their due recognition.

USE OPTION EXPLICIT

Use Option Explicit. I repeat, use Option Explicit. Did I mention that you should always use ...

Get Visual Basic® Style Guide, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.