Mega Code Archive

 
Categories / VB.Net / Data Types
 

Convert Double to Byte

Imports System.Globalization Imports System Module Example    Public Sub Main()         Dim dbl2 As Double = 3.997         Try            Dim value2 As Byte = CByte(dbl2)            Console.WriteLine(value2)         Catch e As OverflowException            Console.WriteLine("{0} is out of range of a byte.", dbl2)         End Try       End Sub End Module