Docstoc

vbEXCEPTIONHANDLING

Document Sample
vbEXCEPTIONHANDLING Powered By Docstoc
					     EXCEPTION HANDLING
   Exceptions : These are the runtime errors which will
    occur when ever the user provides an invalid value at
    the runtime.
   Note : exceptions are not syntax or logical errors.
   Exception Handling  it is used to handle runtime
    errors.
   Exception Handling in VB.Net can be done using 2
    methods
      Unstructured Method.
      Structured Method.
Un Structured Exception Handling
   It supports skipping an error if occurs or it can also be
    handled using this method.
   On error resume next  when ever this statement is
    used as the initial line in any method if any error occurs
    at the runtime then the line which causes the error will
    be ignored and the system will parse or resume from
    next statement.
Unstructured method of handling errors:
   On error goto <error label> : when ever the above statement is
    used in the initial line then if any runtime errors occurs while
    processing the application,the pointer will be moved on to the error
    label block for handling those errors.
   Points to remember 
   If Unstructured method is used to handle the errors then it is
    mandatory to end the method definitions before the error label
    block.
   To terminate a procedure “exit sub” should be used,to terminate a
    function “exit function” should be used.
   Error label block should be always written as the last statements.
    To define the block
    error label:statements to handle the exceptions
   ErrorLabel.Description  returns the error message and
    errorlabel.number returns the error number of the exception.
    Structured Exception Handling
   It can be used to handle the exceptions with the support
    of individual blocks in a structured manner.
   Syntax  try
                „Statements to execute
               Catch Variable as exception class
                „Statements to handle exception
                 Finally
                 „manditory statements
                 end try

   The base class to work with exceptions is
    “system.exception “.
   A single try block can have any no of catch blocks defined for it.
   Try blocks can be nested.
   It is manditory to define at least one catch block for a single try
    block.
   Finally block is an optional block if used within a try block definition
    then the code written in that block will always be executed.
   A single try block can have zero or only one finally block defined for
    it
   When ever an exception occurs then if the try block is defined with
    more than one catch than each and every catch block is verified in
    a sequential order till it encounters with the valid catch block.

				
DOCUMENT INFO
Description: Various ppt files on ASP.NET understanding and VB.Net . Idea about IIS , EXCEPTION HANDLING , MULTI THREADING , CRYSTAL reports,xml