Module throtemp
    Public Class TempIsZeroException : Inherits ApplicationException
        Public Sub New(ByVal msg As String)
            MyBase.New(msg)

        End Sub
    End Class
    Public Class temp
        Dim tmp As Integer = 1
        Sub showtmp()
            If (tmp = 0) Then
                Throw (New TempIsZeroException("zero temp found"))
            Else
                Console.WriteLine("temp:{0}", tmp)

            End If

        End Sub

    End Class
    Sub main()
        Dim temp As temp = New temp()
        Try
            temp.showtmp()

        Catch e As TempIsZeroException
            Console.WriteLine("TempIsZeroException:{0}", e.Message)


        End Try
        Console.ReadKey()

    End Sub
End Module

In the above code,why this class is required and what is the meaning of it?

Public Class TempIsZeroException : Inherits ApplicationException
        Public Sub New(ByVal msg As String)
            MyBase.New(msg)

        End Sub
    End Class

I am bit confused with your code.
Can you directly tell me what you want to create ??????

when exception(problem) occurs in a program, we handle it by Try, Catch and Finally. You can also define your own exception and your code is a perfect example for it.
the above code is a "User-Defined Exceptions" class
ex: Public Class NoInternetConnection : Inherits ApplicationException
and the rest of the code is how you want to handle your exception.
gd luck

I want detailed step by step explanation of this code block:

Public Class TempIsZeroException : Inherits ApplicationException
        Public Sub New(ByVal msg As String)
            MyBase.New(msg)
        End Sub
    End Class

As I did not understand this clearly

The OP's code comes directly from here:
http://www.tutorialspoint.com/vb.net/vb.net_exception_handling.htm
where also is clearly stated:
an exception is a problem that arises during the execution of a program. An exception is a response to an exceptional circumstance that arises while a program is running, such as an attempt to divide by zero.

Exceptions provide a way to transfer control from one part of a program to another. VB.Net exception handling is built upon four keywords: Try, Catch, Finally and Throw.
and:
You can also define your own exception. User-defined exception classes are derived from the ApplicationException class. The following example demonstrates this:OP's code
and you can find every bit on the ApplicationException Class here

Public Class TempIsZeroException : Inherits ApplicationException

Public means that other code can see it
class is A container for data and code
TempIsZeroException is the name of the Class
Inherits is used in the derived class to specify its base class
ApplicationException The exception that is thrown when application error occurs

Public Sub New(ByVal msg As String)

Public means that other code can see it
sub declares the name, parameters, and code that define a Sub procedure.
sub new() the constructor
ByVal, by value,passing a copy of a variable to a Subroutine
msg variable
string text

MyBase.New(msg)

MyBase Provides a way to refer to the base class of the current class instance(.New).

End Sub

Terminates the definition of this procedure.

End Class

the end of the code for the Class.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.