Visual Basic Concepts

Visual Studio 6.0

Code Limitations

The amount of code that can be loaded into a form, class, or standard module is limited to 65,534 lines. A single line of code can consist of up to 1023 bytes. Up to 256 blank spaces can precede the actual text on a single line, and no more than twenty-four line-continuation characters ( _) can be included in a single logical line.

Procedures, Types, and Variables

There is no limit on the number of procedures per module. Each procedure can contain up to 64K of code. If a procedure or module exceeds this limit, Visual Basic generates a compile-time error. If you encounter this error, you can avoid it by breaking extremely large procedures into several smaller procedures, or by moving module-level declarations into another module.

Visual Basic uses tables to store the names of identifiers (variables, procedures, constants, and so on) in your code. Each table is limited to 64K.

DLL Declare Table

Each form and code module uses a table that contains a structure describing a DLL entry point. Each structure uses approximately 40 bytes, with a total restricted size of 64K, resulting in roughly 1,500 declarations allowed per module.

Project-Name Table

The entire application uses a single table that contains all names. These include:

  • Constant names

  • Variable names

  • User-defined — type definition names

  • Module names

  • DLL-procedure declaration names

The project name table is unlimited in total size, but is limited to a total of 32K case-sensitive unique entries. If the limit is reached, reuse private identifiers in different modules to limit the number of unique entries to 32K.

Import Table

Every reference to an identifier in a different module creates an entry in the Import Table. Each such entry is a minimum of 24 bytes and is restricted to 64K, resulting in roughly 2,000 references per module.

Module-Entries Table

This table accepts up to 125 bytes per module, with a total limit of 64K, resulting in about 400 modules per project.

Show: