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 (Visual Basic)

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 (Visual Basic)

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 (Visual Basic)

Raise one numeric value to the power of another

^ Operator (Visual Basic)

Shift the bit pattern of a numeric value to the left

<< Operator (Visual Basic)

Shift the bit pattern of a numeric value to the right

>> Operator (Visual Basic)

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 (Visual Basic)

Determine whether two object variables refer to different object instances

IsNot Operator

Determine whether an object is of a specific type

TypeOf Operator (Visual Basic)

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 (Visual Basic)

Perform logical conjunction on two Boolean values

And Operator (Visual Basic)

Perform inclusive logical disjunction on two Boolean values

Or Operator (Visual Basic)

Perform exclusive logical disjunction on two Boolean values

Xor Operator (Visual Basic)

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 (Visual Basic)

Perform bit-by-bit inclusive logical disjunction on two integral values

Or Operator (Visual Basic)

Perform bit-by-bit exclusive logical disjunction on two integral values

Xor Operator (Visual Basic)

Perform bit-by-bit logical negation on an integral value

Not Operator (Visual Basic)

See Also

Concepts

Operators and Expressions in Visual Basic

Reference

Operators Listed by Functionality