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






NumberStyles.Integer Or NumberStyles.AllowExponent

 

Imports System.Globalization

Module ByteConversion2
   Public Sub Main()
      Dim byteString As String 
      Dim styles As NumberStyles
      byteString = "2E+3   "
      styles = NumberStyles.Integer Or NumberStyles.AllowExponent
      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.HexNumber
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