Imports System.Globalization
Module Example
Public Sub Main()
Dim provider As New NumberFormatInfo()
provider.PositiveSign = "pos "
provider.NegativeSign = "neg "
Dim values() As String = {"pos 1", "neg 1" }
For Each value As String In values
Try
Console.WriteLine("{0,20}", Convert.ToUInt32(value, provider))
Catch e As FormatException
Console.WriteLine("{0,20}", "Bad Format")
Catch e As OverflowException
Console.WriteLine("{0,20}", "Numeric Overflow")
End Try
Next
End Sub
End Module
|