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






NumberStyles.HexNumber

 
Imports System.Globalization

Module ByteConversion2
   Public Sub Main()
      Dim byteString As String 
      Dim styles As NumberStyles

      byteString = "FF"
      styles = NumberStyles.HexNumber
      CallTryParse(byteString, styles)

   End Sub

   Private Sub CallTryParse(stringToConvert As String, styles As NumberStyles)  
      Dim byteValue As Byte
      Dim result As Boolean = Byte.TryParse(stringToConvert, styles, Nothing, byteValue)
      If result Then
         Console.WriteLine("Converted '{0}' to {1}",stringToConvert, byteValue)
      Else
         If stringToConvert Is Nothing Then stringToConvert = ""
         Console.WriteLine("Attempted conversion of '{0}' failed.",stringToConvert.ToString())
      End If                        
   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.AllowHexSpecifier
6.NumberStyles.Integer
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