How to trap "OBJECT REFERENCE NOT SET TO AN INSTANCE OF AN OBJECT" EXCEPTION

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • atishrg
    New Member
    • Apr 2008
    • 9

    How to trap "OBJECT REFERENCE NOT SET TO AN INSTANCE OF AN OBJECT" EXCEPTION

    Hello all,

    I am facing a problem,, that I am not able to trace a "OBJECT REFERENCE NOT SET TO AN INSTANCE OF AN OBJECT" EXCEPTION .... as I am using On error goto _Lable as soon as this exception occures control directly shifted to error lable I want to excute next line even if this exception occures...


    Can Any one help to do this


    Atish
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by atishrg
    Hello all,

    I am facing a problem,, that I am not able to trace a "OBJECT REFERENCE NOT SET TO AN INSTANCE OF AN OBJECT" EXCEPTION .... as I am using On error goto _Lable as soon as this exception occures control directly shifted to error lable I want to excute next line even if this exception occures...


    Can Any one help to do this


    Atish
    You can catch exceptions using a try catch block,however, for that one the cleaner approach is to use a simple if else to test for the null value before derefencing the object.

    Comment

    Working...