This documentation is archived and is not being maintained.

Constants in Visual Basic

Constants store values that, as the name implies, remain constant throughout the execution of an application. Use constants in your code for values that are used repeatedly or to make code more readable.

Constants Overview

Defines constants, and discusses when and where to use them.

Constants Declared by Visual Basic

Lists the constants predefined by Visual Basic.

How to: Declare A Constant

Explains how to use the Const statement to declare a constant and set its value; by declaring a constant, you assign a meaningful name to the value.

User-Defined Constants

Describes how to create your own constants, including information on scoping and how to avoid circular references.

Constant and Literal Data Types

Provides information on how the Visual Basic compiler initializes constants when Option Explicit is turned off.

How to: Group Related Constant Values Together

Demonstrates how to group constant values that are related.

Const Statement (Visual Basic)

Describes the Const statement and its use.

Option Strict Statement

Describes the Option Strict statement and its use.

Enumerations Overview

Discusses enumerations and their use, including common tasks involving enumerations.

Print and Display Constants

Lists print and display constants pre-defined by Visual Basic.

Intrinsic Constants and Enumerations

Discusses the constants and enumerations that Visual Basic provides.

Constants and Enumerations in Visual Basic

What has changed for constants and enumerations in the latest version of Visual Basic.