Siebel VB Language Reference > VB Language Reference >
Chr Function
This standard VB function returns the one-character string corresponding to an ANSI code. Syntax
Chr[$](charCode)
|
|
charCode |
An integer between 0 and 255 representing the ANSI code for a character |
Returns
The character represented by charcode. Usage
The dollar sign ($) in the function name is optional. If it is included, the return type is string; otherwise the function returns a variant of vartype 8 (string). Example
This example displays the character equivalent for an ASCII code between 65 and 122 typed by the user. Sub Button_Click Dim numb as Integer Dim msgtext as String Dim out as Integer out = 0 Do Until out numb = 75 If Chr$(numb)> = "A" AND Chr$(numb)< = "Z" _ OR Chr$(numb)> = "a" AND Chr$(numb)< = "z" then msgtext = "The letter for the number " & numb _ &" is: " & Chr$(numb) out = 1 ElseIf numb = 0 then Exit Sub Else msgtext = "Does not convert to a character; try again." End If Loop End Sub
Related Topics
Asc Function CCur Function CDbl Function CInt Function CLng Function CSng Function CStr Function CVar Function CVDate Function Format Function Val Function
|