Results 1 to 6 of 6

Thread: [RESOLVED] Object Reference not set to an Instance of an Object

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Location
    Chesterfield, UK
    Posts
    162

    Resolved [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?

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    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).
    My usual boring signature: Nothing

  3. #3
    Hyperactive Member umilmi81's Avatar
    Join Date
    Sep 2005
    Location
    Sterling Heights, Mi.
    Posts
    335

    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.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Location
    Chesterfield, UK
    Posts
    162

    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?

  5. #5
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: Object Reference not set to an Instance of an Object

    Unlikely that it has to do with XP, the other is more likely.
    My usual boring signature: Nothing

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Location
    Chesterfield, UK
    Posts
    162

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width