Name

CByte Function

Synopsis

CByte(expression)
expression required; String or Numeric

A string or numeric expression that evaluates to a number between 0 and 255

Named Arguments

No

Return Value

expression converted to Byte data type

Description

Converts expression to a Byte data type. If the expression to be converted is a string, the string must be capable of conversion to a numeric expression; this can be checked using the IsNumeric function. If expression evaluates to less than 0 or more than 255, an exception is generated. If the value of expression is not a whole number, CByte rounds the number prior to conversion.

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.