CSByte Function in VB.NET

How to Convert String to Signed Byte in VB.Net?

Explanation

CSByte Function in VB.NET - Convert String to Signed Byte

CSByte Function in Visual Basic.net 2008 is used convert an expression into a signed byte value.
Syntax:

CSByte(expression)
Example:

Module Module1
Sub Main()
Dim x As Decimal = -16.562
Console.WriteLine('Value of Decimal expression converted to Signed Byte datatype is:: ' & CSByte(x))
Console.ReadLine()
End Sub
End Module
Result:

Value of Decimal expression converted to Signed Byte datatype is::-17

In the above example, an decimal expression is converted to signed byte datatype.

Visual Basic Tutorial


Ask Questions

Ask Question