Convert.ToChar (Int64) converts 64-bit signed integer to Unicode character.
Class Sample
Public Shared Sub Main()
Dim longVal As Long = 999999999999
Dim charVal As Char = "a"c
Try
charVal = System.Convert.ToChar(longVal)
System.Console.WriteLine("{0} as a char is {1}", _
longVal, charVal)
Catch exception As System.OverflowException
System.Console.WriteLine( _
"Overflow in Long-to-Char conversion.")
End Try
' A conversion from Char to Long cannot overflow.
longVal = System.Convert.ToInt64(charVal)
System.Console.WriteLine("{0} as a Long is {1}",charVal, longVal)
End Sub
End Class
Related examples in the same category