The .NET exception that is thrown when there is an attempt to reference (or use) a null or uninitialized object.
A NullReferenceException occurs when you try to reference an object in your code that does not exist. For example, you may have tried to use an object without using the New
keyword first, or tried to use an object
whose value is set to null
(Nothing
in Visual Basic).
Troubleshooting Exceptions: System.NullReferenceException
Also, see "What is a NullReferenceException in .NET and how do I fix it?" for some hints.