Method: CStr for VBS
- Updated2024-09-12
- 1 minute(s) read
Methods > Method: CStr for VBS
Method: CStr for VBS
Converts an expression into the Variant type with the String subtype.
vCStr = Object.CStr(expression)
| Object | VBS Object with this method. You do not need to specify this object. | ||||||||||||||
| expression | Variant Specifies any expression. | ||||||||||||||
| vCStr | Variant Receives the converted value. During conversion the CStr method considers the locale settings of your computer, for example decimal points and thousands separators. Depending on the data type of the input data, the CStr method returns different values.
|
The following example converts numbers into string values and links them:
Dim MyDoubleA, MyDoubleB MyDoubleA = 123 MyDoubleB = 0.456 Call MsgBox(CStr(MyDoubleA) + CStr(MyDoubleB)) ' Returns 1230.456 Call MsgBox(MyDoubleA + MyDoubleB) ' Returns 123.456