Convert numeric string to SByte without a format provider
Imports System
Imports System.Globalization
Imports Microsoft.VisualBasic
Module ToSByteProviderDemo
Sub ConvertToSByte( numericStr As String,provider As IFormatProvider )
Dim defaultValue As Object
Dim providerValue As Object
Try
defaultValue = Convert.ToSByte( numericStr )
Catch ex As Exception
Console.WriteLine( ex )
End Try
Console.WriteLine( defaultValue )
End Sub
Sub Main( )
Dim provider As NumberFormatInfo = new NumberFormatInfo( )
provider.NegativeSign = "neg "
provider.PositiveSign = "pos "
provider.NumberDecimalSeparator = "."
provider.NumberNegativePattern = 0
ConvertToSByte( "123", provider )
End Sub
End Module
Related examples in the same category