Mega Code Archive

 
Categories / VB.Net / Data Types
 

Parse string to Byte

Imports System Module Example     Sub Main()          Dim string1 As String = "244"         Try            Dim byte1 As Byte = Byte.Parse(string1)            Console.WriteLine(byte1)         Catch e As OverflowException            Console.WriteLine("'{0}' is out of range of a byte.", string1)         Catch e As FormatException            Console.WriteLine("'{0}' is out of range of a byte.", string1)         End Try    End Sub End Module