C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Important: The program gets a Char from an Integer. This is useful for calling methods that require Char.
VB.NET program that uses Chr function
Module Module1
Sub Main()
Dim c As Char = "x"c ' Input character.
Dim i As Integer = Asc(c) ' Convert to ascii integer.
Dim h As Char = Chr(i) ' Convert ascii integer to char.
Console.WriteLine(c)
Console.WriteLine(i)
Console.WriteLine(h)
End Sub
End Module
Output
x
120
x
Tip: The Asc and Chr functions are not available in the C# language. They are only useful in VB.NET programs.
And: You can use Asc and Chr in these cases to simplify your program. More information on Val and Asc is available.
Val, Asc