Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))

CByte Function

Syntax

Dim result As Byte = CByte (expression)

expression (required; String or Numeric)

Any expression in the valid range of the Byte data type

Description

The CByte function converts expression to the Byte data type.

Usage at a Glance

  • An expression that evaluates outside the valid range of the target data type results in a runtime error. Nonnumeric expressions also generate an error.

  • This function does not support named arguments.

Example

Dim targetNumber As Byte If IsNumeric(stringNumber) Then targetNumber = CByte(stringNumber) End If

See Also

CSByte Function

Категории