Mega Code Archive

 
Categories / VB.Net / Development
 

Convert ToInt32 (Object) converts the value of the specified object to a 32-bit signed integer

Module Example    Public Sub Main()         Dim values() As Object = { True, -12, 163, 935, "x"c, #5/12/2010#, _                                    "1.00e2", "One", 1.00e2, 16.3e42}         Dim result As Integer                  For Each value As Object In values            Try               result = Convert.ToInt32(value)               Console.WriteLine(result)            Catch e As Exception               Console.WriteLine("Exception")                     End Try         Next                               End Sub End Module