CByte Function in QTP

What is CByte Function :

Returns an expression that has been converted to a Variant of subtype Byte.
The expression argument is any valid expression.


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.
Some more relevant posts covering the VBScript functions and other Vbscript used for coding in QTP.:


Post a Comment

Previous Post Next Post