Method: CSng for VBS
- Updated2024-09-12
- 1 minute(s) read
Methods > Method: CSng for VBS
Method: CSng for VBS
Converts an expression into the Variant type with the Single subtype.
vCSng = Object.CSng(expression)
Object | VBS Object with this method. You do not need to specify this object. |
expression | Variant Specifies any expression. |
vCSng | Variant Receives the converted value. During conversion, the CSng method considers the locale settings of your computer, for example decimal points and thousands separators. |
The following example converts a double value into a single value:
Dim MyDouble MyDouble = 123.456789012 ' Defines a Double Call MsgBox (CSng(MyDouble)) ' Returns 123.4568