Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 23rd, 2007, 03:43 AM
Authorized User
Join Date: Sep 2006
Posts: 11
Thanks: 0
Thanked 1 Time in 1 Post
Default Null Reference Exception was unhandled


I've an application to capture video of image as well as grab still image. It¡¦s running well. Then, I put loop in the code so the application could keep capturing the image repeatedly and automatically. However it gives one exception error:
 NullReferenceException was unhandled „³ ¡¨Object reference not set to an instance of an object".
I found that, this error emerged when I called image from the folder. The reason of my assumption is because when I put comment notation before that line code, the application could run well.
These are the code that call image file from the folder outside of the main body of code programming.

//load an image for subtract
        System.Drawing.Bitmap image2 = (Bitmap)Bitmap.FromFile("plane.Jpeg");
//// apply filter subtract===>>>> call file from out bin folder <<<<=====
        System.Drawing.Bitmap subtract = filter1.Apply(image2);

However, when I run the code, the error refer to this code:
catch (Exception ex)
            throw ex;

For your information, my application not uses any web server for the application. Any body can help me please..

Old February 9th, 2007, 03:15 PM
Authorized User
Join Date: Oct 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to evandro.paula


The "errors" that may not be caught by the catch you used are the ones thrown by COM+ (legacy / not RCW). Have you tried using just a "catch" without especifying the exception type?


Similar Threads
Thread Thread Starter Forum Replies Last Post
unhandled exception dipakp ASP.NET 2.0 Professional 1 July 6th, 2007 02:16 PM
Null reference exception was unhandled labby C# 2005 0 April 24th, 2007 06:14 AM
Null reference exception when using DataAdapter Samantha Karen Webb C# 1 July 21st, 2006 09:12 AM
NULL reference exception Dwizz VB.NET 2002/2003 Basics 3 June 21st, 2005 07:15 AM
Unhandled Exception stu9820 ASP.NET 1.0 and 1.1 Basics 11 January 14th, 2004 05:55 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.