Your own Object Expired Exception : Exception Yours « Development « VB.Net






Your own Object Expired Exception

Your own Object Expired Exception
Imports System
Imports System.Collections

Public Class MainClass
    
    Shared Sub Main(ByVal args As String())
        Try
            Throw New ObjectExpiredException("This object has expired.")
        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try

    End Sub

End Class

Public Class ObjectExpiredException
    Inherits System.ApplicationException
    ' No parameters. Use a default message.
    Public Sub New()
        MyBase.New("This object has expired")
    End Sub
    ' Set the message.
    Public Sub New(ByVal new_message As String)
        MyBase.New(new_message)
    End Sub
    ' Set the message and inner exception.
    Public Sub New(ByVal new_message As String, ByVal inner_exception As Exception)
        MyBase.New(new_message, inner_exception)
    End Sub
End Class
           
       








Related examples in the same category

1.Your own Exception ClassYour own Exception Class
2.A user-defined exception classA user-defined exception class
3.Define and Use your own Exception ClassDefine and Use your own Exception Class