Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))

CStr Function

Syntax

Dim result As String = CStr(expression)

expression (required; any)

Any numeric, date, string, or Boolean expressionor most any other object

Description

The CStr function returns a string representation of expression.

Usage at a Glance

  • If expression is Boolean, the function returns one of the strings "true" or "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 value is a string representing the number.

  • An uninitialized date variable passed to CStr returns "12:00:00AM."

  • This function does not support named arguments.

  • Objects in .NET include a ToString method, which can also be used to convert the object's value to a string format.

See Also

CChar Function, Str Function

Категории