Str Function

Named Arguments

Syntax

CStr( expression) expression

Use: Required

Data Type: Any

Any expression that evaluates to a string. Return Value expression converted to a string. Description

Returns a string representation of expression. Rules at a Glance

• Almost any data can be passed to CStr to be converted to a string.

• CStr is equivalent to the older Str function. Example

Dim sMyString as String SMyString = CStr(100)

Programming Tips & Gotchas

• The string representation of Boolean values is either True or 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."

CStr Function 181

See Also

Format Function, Str Function, Chapter 3

Was this article helpful?

0 0

Post a comment