Hi all,
I have a weird message coming back from an Exe I wrote an am now debugging, stream lining etc. It returns some message boxes which I would expect and then "Object reference not set to an instance of an Object" in a message box I have seen this or similar when I was messing with an Access database. I believe it was trying to shoe horn a string into a numeric field. The program is based on serial comms, no databases involved!
Glenn

3 answers
This error message typically means that you have a 'reference type' variable which is set equal to null and you're then trying to access a property or call a method using that variable. For example:
The fix, of course, is to make sure that someString isn't null before you call the IndexOf() method on it or, if you can't be sure of this, enclose the code in a try/catch block.
answered one year ago by:
17279
The variable you tried to use was pointing to nothing... Reference type variables require you to create the object they point to before you use them... trying to use a variable that has no object assigned to it will throw that exception.
answered one year ago by:
15
Hi to all,
Wrote this question when I had more than one thing on the go (12-15 actually). I did figure this out myself, Thanks as always though!
Glenn
answered one year ago by:
329