Subscripted array not compiling

aewarnick

Senior Contributor
Joined
Jan 29, 2003
Messages
1,031
Error: Highlights the j loop and says, "Object reference not set to an instance of an object."

Help.

int[][]x = new int[6][];
x[0]=new int[] {1,2};
x[1]=new int[] {3,4,5};
x[2]=new int[] {6,7};

for (int i=0; i<x.Length; ++i)
for (int j=0; j<x.Length; ++j)
{
RTB1.Text+=" "+x.Length;
TB2.Text+=" "+x.Length;
TB1.Text+=x[j];
RTB2.Text+=x[j];
}
 
Back
Top