|
-
Mar 18th, 2007, 05:14 PM
#1
Re: [2005] NullReferenceException was unhandled
It's a VERY risky solution. Your program is NOT running right, you just haven't encountered the real problem. Furthermore, that exception is costing you in performance. A safer, and more .NET solution, would be to use a Try...Catch block to trap the error. You could still ignore the error if you wanted to, but it still wouldn't be a good idea. In fact, using any error handling at all in this case isn't a really good idea.
This particular error is always a fairly simple one to solve, you might just have some difficulty tracking down which item has not yet been initialized. I believe that the error is less common in 2005 than in earlier versions of .NET because there are now default instances of lots of objects. If you fail to instantiate a new object, the default instance is used.
Assuming that the error happens on that line, and assuming that you are running in debug mode, you can simply look at the objects in the line (ADGW, ADGW.CurrentRow, ADWG.CurrentRow.Cells(0), and the label). Using Shift+F9, you will find that one of those three is Nothing. I would guess that it is the CurrentRow that is the issue, and my next guess would be the Cells(0).
When you figure out which one it is, you will probably find a way to improve your program.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|