Common Tasks Performed with Visual Basic Operators

 

Updated: July 20, 2015

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

Operators perform many common tasks involving one or more expressions called operands.

The following table summarizes the available arithmetic and bit-shift operations.

ToSee
Add one numeric value to another+ Operator
Subtract one numeric value from another- Operator (Visual Basic)
Reverse the sign of a numeric value- Operator (Visual Basic)
Multiply one numeric value by another* Operator
Divide one numeric value into another/ Operator (Visual Basic)
Find the quotient of one numeric value divided by another (without the remainder)\ Operator (Visual Basic)
Find the remainder of one numeric value divided by another (without the quotient)Mod Operator
Raise one numeric value to the power of another^ Operator
Shift the bit pattern of a numeric value to the left<< Operator
Shift the bit pattern of a numeric value to the right>> Operator

The following table summarizes the available comparison operations.

ToSee
Determine whether two values are equal= Operator (Comparison Operators in Visual Basic)
Determine whether two values are unequal<> Operator (Comparison Operators in Visual Basic)
Determine whether one value is less than another< Operator (Comparison Operators in Visual Basic)
Determine whether one value is greater than another> Operator (Comparison Operators in Visual Basic)
Determine whether one value is less than or equal to another<= Operator (Comparison Operators in Visual Basic)
Determine whether one value is greater than or equal to another>= Operator (Comparison Operators in Visual Basic)
Determine whether two object variables refer to the same object instanceIs Operator
Determine whether two object variables refer to different object instancesIsNot Operator
Determine whether an object is of a specific typeTypeOf Operator

The following table summarizes the available concatenation operations.

ToSee
Join multiple strings into a single string& Operator (Concatenation Operators in Visual Basic)
Join numeric values with string values+ Operator (Concatenation Operators in Visual Basic)

The following table summarizes the available logical and bitwise operations.

ToSee
Perform logical negation on a Boolean valueNot Operator
Perform logical conjunction on two Boolean valuesAnd Operator
Perform inclusive logical disjunction on two Boolean valuesOr Operator
Perform exclusive logical disjunction on two Boolean valuesXor Operator
Perform short-circuited logical conjunction on two Boolean valuesAndAlso Operator
Perform short-circuited inclusive logical disjunction on two Boolean valuesOrElse Operator
Perform bit-by-bit logical conjunction on two integral valuesAnd Operator
Perform bit-by-bit inclusive logical disjunction on two integral valuesOr Operator
Perform bit-by-bit exclusive logical disjunction on two integral valuesXor Operator
Perform bit-by-bit logical negation on an integral valueNot Operator

Operators and Expressions
Operators Listed by Functionality

Show: