Any numeric, date, string, or Boolean expression
expression converted to a string
Returns a string representation of
Rules at a Glance
expression is Boolean, the function
returns one of the strings
"False". For an expression that can be interpreted
as a date, the return value is a string representation of that date,
in the short date format of the host computer. For a numeric
expression, the return is a string representing the number.
Dim sMyString as String sMyString = CStr(100)
Programming Tips and Gotchas
The string representation of Boolean values is either
"False", as opposed to their underlying values of 0 and -1.
Uninitialized numeric data types passed to CStr return “0.”
An uninitialized date variable passed to CStr returns “12:00:00AM.”
Like most of the conversion functions, CStr is not actually a function in the Microsoft.VisualBasic namespace. Instead, it is similar to a Visual C++ macro; the compiler translates the function call into inline code.