Mega Code Archive

 
Categories / VB.Net / Development
 

Convert double to Integer

Class Sample    Public Shared Sub Main()         Dim dbl2 As Double = 2010.997         Try            Dim number2 As Integer = CInt(dbl2)            Console.WriteLine(number2)         Catch e As OverflowException            Console.WriteLine("{0} is out of range of an Int32.", dbl2)         End Try     End Sub  End Class