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






NumberStyles.Integer Or NumberStyles.AllowDecimalPoint

 

Imports System.Globalization

Module ByteConversion2
   Public Sub Main()
      Dim byteString As String 
      Dim styles As NumberStyles
      byteString = "100.1"
      styles = NumberStyles.Integer Or NumberStyles.AllowDecimalPoint
      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.AllowLeadingSign Or NumberStyles.AllowTrailingSign
2.NumberStyles.Integer Or NumberStyles.AllowThousands
3.NumberStyles.Integer Or NumberStyles.AllowExponent
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