\ Operator
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

\ Operator

Divides two numbers and returns an integer result.

number1 \ number2


Required. Any numeric expression of an integral type.
Required. Any numeric expression of an integral type.

Supported Types

Byte, Short, Integer, or Long.


The result is the integer quotient of number1 and number2, dropping the remainder.


Before division is performed, any floating-point numeric expressions are coerced to Long if Option Strict is Off. If Option Strict is On, a compiler error results.

The data type of the result is Byte, Short, Integer, or Long. Any fractional portion is truncated.

If any expression is stated as Nothing, it is treated as zero. Attempting to perform integer division by zero causes a DivideByZeroExeception to be thrown.


This example uses the \ operator to perform integer division. The result is an integer representing the integer quotient of the two operands.

Dim myValue As Integer
myValue = 11 \ 4   ' Returns 2.
myValue = 9 \ 3   ' Returns 3.
myValue = 100 \ 3   ' Returns 33.
MyValue = 67 \ -3   ' Returns -22.

See Also

\= Operator | / Operator | Arithmetic Operators | Operator Precedence in Visual Basic | Operators Listed by Functionality | Arithmetic Operators

© 2015 Microsoft