Imports System.Globalization
Module Example
Public Sub Main()
Dim nf As New NumberFormatInfo()
nf.NegativeSign = "~"
Dim values() As String = { "-103", "~16" }
Dim providers() As IFormatProvider = { nf, CultureInfo.InvariantCulture }
For Each provider As IFormatProvider In providers
Console.WriteLine("Conversions using {0}:", CObj(provider).GetType().Name)
For Each value As String In values
Try
Console.WriteLine("Converted '{0}' to {1}.",value, SByte.Parse(value, provider))
Catch e As FormatException
Console.WriteLine("Unable to parse '{0}'.", value)
Catch e As OverflowException
Console.WriteLine("'{0}' is out of range of the SByte type.", value)
End Try
Next
Next
End Sub
End Module