Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Statements in Visual Basic 

A statement in Visual Basic is a complete instruction that can contain keywords, operators, variables, constants, and expressions. All statements fall into one of two categories: declaration statements, which name a variable, constant, or procedure and can also specify a data type; or executable statements, which initiate actions.

In This Section

Statements Overview

Provides a high-level look at statements, including how to have multiple statements on one line, continue a statement over multiple lines, add comments, and check compilation errors.

Assignment Statements

Describes statements that carry out assignment operations, which assign the value on the right side of the operator to the variable on the left side.

Declaration Statements in Visual Basic

Describes statements that name and define procedures, variables, arrays, and constants.

Executable Statements

Describes statements that initiate action by executing a method. Executable statements can loop or branch through blocks of code, and often contain mathematical or conditional operators.

Related Sections

Assignment Operators

Provides links to language reference pages covering assignment operators such as =, *=, and &=.

Operators and Expressions in Visual Basic

Shows how to combine elements with operators to yield new values.

© 2016 Microsoft