Divides two numbers and returns an integer result.
number1 \ number2
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 Byte, Short, Integer, or Long expressions 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, or Empty, 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.
\= Operator | / Operator | Arithmetic Operators | Operator Precedence in Visual Basic | Operators Listed by Functionality |