Object reference not set to an instance of an object.

Mar 28 2006 10:42 PM

The following code throws this error:

An unhandled exception of type 'System.NullReferenceException' occurred in Classes.exe
Additional information: Object reference not set to an instance of an object.

When I call the form load function it throws the above error and Im not sure why.

namespace Classes
{
/// <summary>

/// Summary description for Class1.

/// </summary>

public class ActSessions

{

public ActSessions()

{

//

// TODO: Add constructor logic here

//

}

public class User

{

public string name;

public string tabindex;

}

public User [] UserArray = new User[100]; 

}
}


 

private void Form1_Load(object sender, System.EventArgs e)

{

ActSessions Active = new ActSessions();

Active.UserArray[0].name = "JOHN"; //this line throw the error

}


Answers (3)