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.
In This Section
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.
Reference
Const Statement (Visual Basic)
Describes the Const statement and its use.Option Strict Statement
Describes the Option Strict statement and its use.
Related Sections
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.