Mega Code Archive

 
Categories / VB.Net / Development
 

Convert ToInt32 (Char) converts Unicode character to 32-bit signed integer

Module Example    Public Sub Main()         Dim chars() As Char = { "a"c, "z"c, ChrW(7), ChrW(2010), _                                 ChrW(Short.MaxValue), ChrW(&hFFFE) }         Dim result As Integer                  For Each ch As Char in chars            Try               result = Convert.ToInt32(ch)               Console.WriteLine(result)            Catch e As OverflowException               Console.WriteLine("OverflowException")            End Try         Next       End Sub End Module