CByte - function of language VBScript

Returns an expression that has been converted to type Byte.

For the purposes of PROMOTIC system, it is more usefull to use the method: Pm.Round, Pm.Trunc or Pm.ToNumber.

CByte(expression As Variant) As Byte
n = CByte(expression)
expression(Variant) Any valid expression.

The conversion functions can be used e.g. if you want some operation result to be expressed as a particular data type (rather than the default data type). For example, use CByte to force Byte data type in cases where 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 type. For example, different decimal separators are properly recognized depending on the locale setting of Windows system, as are different thousand separators.

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

VBScriptSelect and copy to clipboard

Dim nDouble, nByte
nDouble = 125.5678
nByte = CByte(nDouble)  'nByte contains 126
PROMOTIC 8.3.30 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice