Sun Chili!Soft ASP Sun Chili!Soft
ASP Sun Microsystems

 

VBScript CByte Function

Returns an expression that has been converted to a Variant of subtype Byte.

Syntax: VBScript CByte Function

CByte(expression)

Arguments: VBScript CByte Function

expression

Any valid expression.

Remarks: VBScript CByte Function

In general, you can document your code using the subtype conversion functions to show that the result of some operation should be expressed as a particular data type rather than the default data type. For example, use CByte to force byte arithmetic in cases where currency, single-precision, double-precision, or integer arithmetic normally would occur.

Use the CByte function to provide internationally aware conversions from any other data type to a Byte subtype. For example, different decimal separators are properly recognized depending on the locale setting of your system, as are different thousand separators.

If expression lies outside the acceptable range for the Byte subtype, an error occurs.

The following example uses the CByte function to convert an expression to a byte:

Dim MyDouble, MyByte

MyDouble = 125.5678        ' MyDouble is a Double.

MyByte = CByte(MyDouble)   ' MyByte contains 126.

Copyright 2002 Sun Microsystems, Inc. All rights reserved. Legal Notice.