Convert.ToSByte (Char) converts Unicode character to 8-bit signed integer.
Module Example
Public Sub Main()
Dim chars() As Char = { "a"c, "z"c, ChrW(7), ChrW(200), ChrW(2010) }
For Each ch As Char in chars
Try
Dim result As SByte = Convert.ToSByte(ch)
Console.WriteLine("{0} is converted to {1}.", ch, result)
Catch e As OverflowException
Console.WriteLine("Unable to convert u+{0} to a byte.", _
AscW(ch).ToString("X4"))
End Try
Next
End Sub
End Module
Related examples in the same category