Convert single value to decimal
Module Example
Public Sub Main()
Dim numbers() As Single = { Single.MinValue, -3e10, -1093.54, 0, 1e-03, _
1034.23, Single.MaxValue }
Dim result As Decimal
For Each number As Single In numbers
Try
result = Convert.ToDecimal(number)
Console.WriteLine("Converted the Single value {0} to {1}.", number, result)
Catch e As OverflowException
Console.WriteLine("{0} is out of range of the Decimal type.", number)
End Try
Next
End Sub
End Module
Related examples in the same category