Results 1 to 3 of 3

Thread: null reference error??? help please

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2005
    Posts
    150

    null reference error??? help please

    hey guys
    I am getting the error

    An unhandled exception of type 'System.NullReferenceException' occurred in Testharness.exe

    Additional information: Object reference not set to an instance of an object.


    --------------------------------------------------------
    namespace AdaptorPropertyNamespace
    {
    public class AdaptorProperty
    {
    public string propertyName;
    public string propertyStringValue;
    }
    }

    ---------------------------------------------------------
    AdaptorProperty[] properties = new AdaptorProperty[2];
    properties[0].propertyName = "title";

    ----------------------------------------------------------

    why does my program break out at 'properties[0].propertyName = "title";' with a null reference error?

    thanx in advance

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: null reference error??? help please

    Code:
            AdaptorProperty[] properites = new AdaptorProperty[2];
            properites[0] = new AdaptorProperty();
            properites[0].propertyName = "TITLE";
    Because you'd declared the arrays, but not the objects themselves.

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: null reference error??? help please

    Sorry about the spelling.

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