Common Tasks Performed with Visual Basic Operators

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

Arithmetic and Bit-shift Tasks

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

To See
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

Comparison Tasks

The following table summarizes the available comparison operations.

To See
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 instance Is Operator
Determine whether two object variables refer to different object instances IsNot Operator
Determine whether an object is of a specific type TypeOf Operator

Concatenation Tasks

The following table summarizes the available concatenation operations.

To See
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)

Logical and Bitwise Tasks

The following table summarizes the available logical and bitwise operations.

To See
Perform logical negation on a Boolean value Not Operator
Perform logical conjunction on two Boolean values And Operator
Perform inclusive logical disjunction on two Boolean values Or Operator
Perform exclusive logical disjunction on two Boolean values Xor Operator
Perform short-circuited logical conjunction on two Boolean values AndAlso Operator
Perform short-circuited inclusive logical disjunction on two Boolean values OrElse Operator
Perform bit-by-bit logical conjunction on two integral values And Operator
Perform bit-by-bit inclusive logical disjunction on two integral values Or Operator
Perform bit-by-bit exclusive logical disjunction on two integral values Xor Operator
Perform bit-by-bit logical negation on an integral value Not Operator

See also