Object references is not set to an object.For what this error?
When you declare a variable its simply a reference to object so that you can easily refer to it in your code. If you declare a variable but you don't create don't create an instance of that object, the variable just points to Null.
Its like you are creating a place holder for something that is going to exist in the future but there's nothing currently in it. When you try to use the object like this, the computer tries to access something that's not there. Therefore you will get a Null Reference Exception with an error message like the one you've described.
In order to avoid this you have to set the variable to an instance of the object.
In other words, when you declare a variable you have to call the constructor of the object you'd like to use in order to create instance of it before you try to use the object.
To do this using VB you have to use New...
eg:
Dim a As ObjectA = new ObjectA()
Also you may get this error if the object has expired and then you try to use it. (eg the object only exists during one function and you try to use the object outside of the function)
Hope this helps
-Frinny