Link to home
Start Free TrialLog in
Avatar of danielolorenz
danielolorenz

asked on

Object Reference not set to an Instance of an Object

CSS.SSD.Request.CaseLoadData[] data1  = new CSS.SSD.Request.CaseLoadData[1];

// XMLRequest test data
data1[0].Action = "UPDATE/CLOSE";
data1[1].Action = "CREATE";

Right when the code gets to data1[0].Action - I get the error message, Object Reference Not Set to an Instance of an Object

Thanks,

Dan
Avatar of Dmitry G
Dmitry G
Flag of New Zealand image

Not sure what classes are you using, but...

OK, you declare an array of CaseLoadData objects. By the way, the array has just 1 element!
You do not populate it. Of course, calling data1[0].Action will cause a problem because data1[0] is null. I.e., the array element does NOT contain an object.

The next call, data1[1] , will cause System.IndexOutOfRangeException.
Avatar of danielolorenz
danielolorenz

ASKER

Thanks.  Okay, then what is the correct way to insert UPDATE/CREATE and CLOSE into the data1 array?  Can you give me a code example?

Thanks,

Dan
ASKER CERTIFIED SOLUTION
Avatar of Dmitry G
Dmitry G
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Worked. Very interesting solution.