Converts a Decimal to an 8-bit unsigned integer. : Decimal « Data Types « VB.Net






Converts a Decimal to an 8-bit unsigned integer.

  

Option Strict On

Module DecimalToS_ByteDemo
    Public Sub DecimalToS_Byte(argument As Decimal)
        Dim sByteValue As Object
        Dim byteValue As Object

        ' Convert the argument to an sbyte value.
        Try
            sByteValue = CByte(argument)
        Catch ex As Exception
            sByteValue = ex.GetType().Name
        End Try

        ' Convert the argument to a byte value.
        Try
            byteValue = CType(argument, Byte)
        Catch ex As Exception
            byteValue = ex.GetType().Name
        End Try

        Console.WriteLine( sbyteValue )
        Console.WriteLine( byteValue )
    End Sub

    Public Sub Main( )
        DecimalToS_Byte(78d)
    End Sub
End Module

   
    
  








Related examples in the same category

1.Convert String to DecimalConvert String to Decimal
2.Append decimal data type values to a StringBuilder object.
3.Generic and nongeneric versions of the CompareTo method for Decimal value
4.Use the Sign(Decimal) method to determine the sign of a Decimal value and display it to the console.
5.Decimal Constructor (Double)
6.Decimal Constructor
7.Initializes a new instance of Decimal to the value of the specified 64-bit signed integer.
8.Decimal Constructor (Single)
9.Create Decimal from specified 32-bit unsigned integer.
10.Create Decimal from specified 64-bit unsigned integer.
11.Adds two specified Decimal values.
12.Decimal.Ceiling Returns the smallest integral value that is greater than or equal to the specified decimal number.
13.Decimal.Compare Method Compares two specified Decimal values.
14.Decimal.CompareTo Compares this instance to a specified Object.
15.Divides two specified Decimal values.
16.Decimal.FromOACurrency Method Converts an OLE Automation Currency value to the equivalent Decimal value.
17.Decimal.GetBits Method Converts Decimal to binary representation.
18.Decimal.Round Method Rounds a Decimal value to a specified number of decimal places.
19.Decimal.ToByte Method Converts the value of the specified Decimal to the equivalent 8-bit unsigned integer.
20.Decimal.ToDouble Method Converts Decimal to double
21.Decimal.ToInt16 Method Converts Decimal to 16-bit signed integer.
22.Decimal.ToInt32 Method Converts Decimal to 32-bit signed integer.
23.Decimal.ToInt64 Method Converts Decimal to 64-bit signed integer.
24.Decimal.ToOACurrency Method Converts Decimal to OLE Automation Currency value
25.Decimal.ToString Method
26.Decimal ToString: G
27.NumberStyles.AllowDecimalPoint
28.NumberStyles.AllowDecimalPoint Or NumberStyles.AllowThousands
29.Converts a Decimal to a double-precision floating-point number.
30.Converts a Decimal to a 16-bit signed integer.
31.Converts a Decimal to a 32-bit signed integer.
32.Converts a Decimal to a 64-bit signed integer.
33.Converts a double-precision floating-point number to a Decimal.
34.Converts a single-precision floating-point number to a Decimal.
35.Converts an 8-bit unsigned integer to a Decimal.