[RESOLVED] Object Reference not set to an Instance of an Object
Help!!!
I have a user control which is a textbox with a couple of extra features, like background colour change on focus, number formatting etc. All this works fine, however, my machine died and instead on putting back windows 2000 prof I went for XP. I've reloaded everything and put my user control back onto my toolbox. As soon as I drag the user control onto the form I get the message 'Object Reference not set to an Instance of an Object'.
I've tried recompiling the user control and removing it and re adding it to the toolbox but nothing I try seems to work. If I reload an old project the user control does not show on the form. I've also tried removing and re adding the reference as well.
Any ideas?
Re: Object Reference not set to an Instance of an Object
That error is always the same, something was not declared properly. By breaking on the line that causes the error, look at all the objects, one will be nothing. That object has been declared (the intention to create it was announced), but not instantiated (the actual object was not created).
Re: Object Reference not set to an Instance of an Object
Assuming you didn't change any code, you are missing a DLL somewhere.
In your control, go to project->references. There should be a checked item that says "Missing:" next to it. This tells you what library you are missing. Get that DLL onto your system and try again.
Of course this sounds more like you made a change somewhere and didn't create (instantiate) an object with the "New" operator.
Re: Object Reference not set to an Instance of an Object
The user control is a DLL and i'm sure that this is not the fault as its been working for months.
Could it be something todo with XP? or could it be some setting i've missed when I've recreated the DLL?
Re: Object Reference not set to an Instance of an Object
Unlikely that it has to do with XP, the other is more likely.
Re: Object Reference not set to an Instance of an Object
Sorry everybody, the colours on the textbox were registry settings and I had not recreated them!
Sorry for wasting everybodys time.