Mega Code Archive

 
Categories / VB.Net / Development
 

Convert ToUInt32 (String, IFormatProvider) converts string to 32-bit unsigned integer using culture-specific format

Imports System.Globalization Module Example    Public Sub Main()       Dim provider As New NumberFormatInfo()        provider.PositiveSign = "pos "       provider.NegativeSign = "neg "       Dim values() As String = { "123456789", "+123456789", "pos 123456789", _                                  "111111111", "-1", "neg 1" }       For Each value As String In values          Console.Write("{0,-20} -->", value)          Try             Console.WriteLine("{0,20}", Convert.ToUInt32(value, provider))          Catch e As Exception             Console.WriteLine("Exception")          End Try          Next     End Sub  End Module