Convert.ToInt32 (Decimal) converts decimal number to 32-bit signed integer. : Convert to Int32 « Development « VB.Net






Convert.ToInt32 (Decimal) converts decimal number to 32-bit signed integer.

  

Module Example
   Public Sub Main()
        Dim values() As Decimal = { Decimal.MinValue, -1034.23d, -12d, 0d, 147d, _
                                    199.55d, 9214.16d, Decimal.MaxValue }
        Dim result As Integer
        
        For Each value As Decimal In values
           Try
              result = Convert.ToInt32(value)
              Console.WriteLine(result)
           Catch e As OverflowException
              Console.WriteLine("OverflowException")
           End Try   
        Next                                  
   End Sub
End Module

   
    
  








Related examples in the same category

1.Convert.ToInt32 (Boolean) converts Boolean value to 32-bit signed integer.
2.Convert.ToInt32 (Byte) converts 8-bit unsigned integer to 32-bit signed integer.
3.Convert.ToInt32 (Char) converts Unicode character to 32-bit signed integer.
4.Convert.ToInt32 (Double) converts double number to 32-bit signed integer.
5.Convert.ToInt32 (Int16) converts 16-bit signed integer to 32-bit signed integer.
6.Convert.ToInt32 (Int64) converts 64-bit signed integer to 32-bit signed integer.
7.Convert.ToInt32 (Object) converts the value of the specified object to a 32-bit signed integer.
8.Convert.ToInt32 (SByte) converts 8-bit signed integer to 32-bit signed integer.
9.Convert.ToInt32 (Single) converts single-precision floating-point number to 32-bit signed integer.
10.Convert.ToInt32 (String) converts string to an equivalent 32-bit signed integer.
11.Convert.ToInt32 (String, IFormatProvider) converts string to 32-bit signed integer using culture-specific format
12.Convert.ToInt32 (String, Int32) converts string in a base to 32-bit signed integer.
13.Convert.ToInt32 (UInt16) converts 16-bit unsigned integer to 32-bit signed integer.
14.Convert.ToInt32 (UInt32) converts 32-bit unsigned integer to 32-bit signed integer.
15.Convert.ToInt32 (UInt64) converts 64-bit unsigned integer to an equivalent 32-bit signed integer.