Export (0) Print
Expand All

Strings.ChrW Method

Returns the character associated with the specified character code.

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

'Declaration
Public Shared Function ChrW ( _
	CharCode As Integer _
) As Char

Parameters

CharCode
Type: System.Int32
Required. An Integer expression representing the code point, or character code, for the character. If CharCode is outside the valid range, an ArgumentException error occurs. The valid range for ChrW is -32768 through 65535.

Return Value

Type: System.Char
Returns the character associated with the specified character code.

ChrW takes CharCode as a Unicode code point. The range is independent of the culture and code page settings for the current thread. Values from -32768 through -1 are treated the same as values in the range +32768 through +65535.

Numbers from 0 through 31 are the same as standard nonprintable ASCII codes. For example, ChrW(10) returns a line feed character.

The asymmetric range accepted for CharCode compensates for the storage differences between the Short data type and the Integer data type. For example, -29183 is a Short but +36353 is an Integer.

The following example uses the ChrW function to return the character associated with the specified character code.


Dim associatedChar As Char
' Returns "A".
associatedChar = ChrW(65)
' Returns "a".
associatedChar = ChrW(97)
' Returns ">".
associatedChar = ChrW(62)
' Returns "%".
associatedChar = ChrW(37)


Silverlight

Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft