Convert.ToString Method (Byte)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Converts the value of the specified 8-bit unsigned integer to its equivalent String representation.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- value
- Type: System.Byte
An 8-bit unsigned integer.
This implementation is identical to Byte.ToString.
The following code sample illustrates the conversion of a Byte to a String, using ToString.
Public Sub ConvertStringByte(ByVal stringVal As String) Dim byteVal As Byte = 0 Try byteVal = System.Convert.ToByte(stringVal) outputBlock.Text &= String.Format("{0} as a byte is: {1}", _ stringVal, byteVal) & vbCrLf Catch exception As System.OverflowException outputBlock.Text &= String.Format( _ "Overflow in string-to-byte conversion.") & vbCrLf Catch exception As System.FormatException outputBlock.Text &= String.Format( _ "The String is not formatted as a Byte.") & vbCrLf Catch exception As System.ArgumentException outputBlock.Text &= "The String is null." & vbCrLf End Try 'The conversion from byte to string is always valid. stringVal = System.Convert.ToString(byteVal) outputBlock.Text &= String.Format("{0} as a string is {1}", _ byteVal, stringVal) & vbCrLf End Sub
Show: