VB.Net by API/System/Exception

Материал из VB Эксперт
Версия от 12:51, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Exception.Message

  

Imports System
Public Class MainClass
    
    Shared Sub Main(ByVal args As String())
        Try
            CalculateValue()
        Catch ex As Exception
            Console.WriteLine( "ex.Message:" & ex.Message )
            Console.WriteLine( "ex.StackTrace:" & ex.StackTrace )
            Console.WriteLine( "ex.ToString:" & ex.ToString )
        End Try
    End Sub
    
    Shared Private Function CalculateValue() As Integer
        Return 1 \ Integer.Parse("0")
    End Function
End Class


Exception.StackTrace

  
Imports System
Public Class MainClass
    
    Shared Sub Main(ByVal args As String())
        Try
            CalculateValue()
        Catch ex As Exception
            Console.WriteLine( "ex.Message:" & ex.Message )
            Console.WriteLine( "ex.StackTrace:" & ex.StackTrace )
            Console.WriteLine( "ex.ToString:" & ex.ToString )
        End Try
    End Sub
    
    Shared Private Function CalculateValue() As Integer
        Return 1 \ Integer.Parse("0")
    End Function
End Class


Exception.ToString

  
Imports System
Public Class MainClass
    
    Shared Sub Main(ByVal args As String())
        Try
            CalculateValue()
        Catch ex As Exception
            Console.WriteLine( "ex.Message:" & ex.Message )
            Console.WriteLine( "ex.StackTrace:" & ex.StackTrace )
            Console.WriteLine( "ex.ToString:" & ex.ToString )
        End Try
    End Sub
    
    Shared Private Function CalculateValue() As Integer
        Return 1 \ Integer.Parse("0")
    End Function
End Class