Chr Function in VB.NET

How to convert ascii value to character in Vb.Net?


Chr Function - Convert Ascii Value to Character

Chr Function in Visual 2008 is used to return the character for the specified Character Code(Ascii Value).

Function Chr(ByVal CharCode As Integer) As Char

In the above syntax CharCode specifies the Character Code based on which the associated character is returned.

Module Module1
Sub Main()
Console.WriteLine("Character for Character
Code 45 is::" & Chr("45"))
Console.WriteLine("Character for Character
Code 76 is::" & Chr("76"))
End Sub
End Module

Character for Character Code 45 is::-
Character for Character Code 76 is::L

In the above example, the character for the the ascii value '45' and '76' are returned as '-' and 'L' using chr convert function.

Visual Basic Tutorial

Ask Questions

Ask Question