Convert.ToSByte (Char) converts Unicode character to 8-bit signed integer. : Convert to SByte « Development « VB.Net






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

1.Convert.ToSByte (String) converts string to 8-bit signed integer.
2.Convert.ToSByte (String, Int32) converts string in a base to 8-bit signed integer.
3.Convert.ToSByte (UInt16) converts 16-bit unsigned integer to 8-bit signed integer.
4.Convert.ToSByte (UInt32) converts 32-bit unsigned integer to 8-bit signed integer.
5.Convert.ToSByte (UInt64) converts 64-bit unsigned integer to 8-bit signed integer.
6.Convert.ToSByte (Boolean) converts Boolean to 8-bit signed integer.
7.Convert.ToSByte (Byte) converts 8-bit unsigned integer to 8-bit signed integer.
8.Convert.ToSByte (Decimal) converts decimal number to 8-bit signed integer.
9.Convert.ToSByte (Double) converts double-precision floating-point number to 8-bit signed integer.
10.Convert.ToSByte (Int16) converts 16-bit signed integer to 8-bit signed integer.
11.Convert.ToSByte (Int32) converts 32-bit signed integer to 8-bit signed integer.
12.Convert.ToSByte (Int64) converts 64-bit signed integer to 8-bit signed integer.
13.Convert.ToSByte (Object) converts object to an 8-bit signed integer.