Mega Code Archive

 
Categories / VB.Net / Data Types
 

Convert Integer to Byte

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