When you get an error such as
Object reference not set to an instance of an object
It means that one of your objects is not initialized. With your debugger attached, you should get a line number and exception details right within the IDE. You can use that to work through the error above.
There are several samples and troubleshooting efforts
here[
^] for a range of problems.
Cheers.