Siebel VB Language Reference > Siebel VB Language Reference >

CStr Function


This standard VB function converts an expression to the data type string.

Syntax

CStr(expression)

Argument
Description
expression
Any expression that can evaluate to a number

Returns

A string containing the value of expression.

Expression
Return value
Date
A string containing a date
Empty
A zero-length string ("")
Error
A string containing Error, followed by the error number
Null
A run-time error
Other Numeric
A string containing the number

Example

This example uses the string functions to operate on a string that was originally entered as a number.

Sub Button_Click
   Dim var1, msgtext as String, code as Integer
   var1 = 77

   msgtext = Cstr(var1)
   msgtext = Left(var1,1)
   code = Asc(msgtext)

   msgtext = "The first digit you entered was," & msgtext
   msgtext = msgtext & ". Its ANSI code is " & code & "."
End Sub

See Also

Asc Function
CCur Function
CDbl Function
Chr Function
CInt Function
CLng Function
CSng Function
CVar Function
CVDate Function
Format Function


 Siebel VB Language Reference
 Published: 18 June 2003