NumberStyles.Integer : NumberStyles « Internationalization I18N « VB.Net






NumberStyles.Integer

 



Imports System.Globalization

Module modMain
   Public Sub Main()
      Dim byteString As String 

      byteString = "0x21"
      ParseString(byteString, NumberStyles.Integer)
      ParseString(byteString, NumberStyles.AllowHexSpecifier)

   End Sub

   Private Sub ParseString(value As String, style As NumberStyles)
      Dim number As SByte

      Try
         number = SByte.Parse(value, style, NumberFormatInfo.CurrentInfo)
         Console.WriteLine("SByte.Parse(""{0}"", {1})) = {2}", value, style.ToString, number)   
      Catch e As Exception
         Console.WriteLine("'{0}' and {1} throw a {2}", value, style.ToString, e.GetType.Name)   
      End Try     
   End Sub
End Module

   
  








Related examples in the same category

1.NumberStyles.Integer Or NumberStyles.AllowDecimalPoint
2.NumberStyles.Integer Or NumberStyles.AllowLeadingSign Or NumberStyles.AllowTrailingSign
3.NumberStyles.Integer Or NumberStyles.AllowThousands
4.NumberStyles.Integer Or NumberStyles.AllowExponent
5.NumberStyles.HexNumber
6.NumberStyles.AllowHexSpecifier
7.NumberStyles.Integer Or NumberStyles.AllowThousands
8.NumberStyles.AllowParentheses Or NumberStyles.AllowTrailingSign Or NumberStyles.Float Or NumberStyles.AllowThousands
9.System.Globalization.NumberStyles.AllowDecimalPoint
10.System.Globalization.NumberStyles.AllowDecimalPoint Or System.Globalization.NumberStyles.AllowThousands