Imports System.Globalization
Module Example
Public Sub Main()
Dim provider As New NumberFormatInfo()
provider.PositiveSign = "pos "
provider.NegativeSign = "neg "
Dim values() As String = {"-3", "+3", "pos 3"}
For Each value As String In values
Try
Console.WriteLine("{0,17}", Convert.ToUInt16(value, provider))
Catch e As FormatException
Console.WriteLine("{0,17}", e.GetType().Name)
End Try
Next
End Sub
End Module
|