Name

CInt Function

Synopsis

CInt(expression)
expression required; Numeric or String

A numeric value or a string representation of a number

Named Arguments

No

Return Value

expression cast as an Integer

Description

Converts expression to an Integer data type. If expression has a fractional value, it is rounded. When the fractional part of expression is exactly .5, CInt always rounds it to the nearest even number. If expression is not numeric or is outside the range of the Integer data type, an exception is generated. Use IsNumeric to test whether expression evaluates to a number.

Get VB.NET Language Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.