Error I Don't Understand

xx = 0; yy = 0; num = 1; objPosX[num] = xx; objPosY[num] = yy;

Could someone please tell me what is wrong with this code. I don’t understand why I get the error System.NullReferenceException: Object reference not set to an instance of an object.

objPosX or objPosY is null/ not initialized.
Break this line to individual lines so you can see which statement throws the error. Use Immediate Window or mouse over objPosX / objPosY to see which one is null.
At some point you must initialize them with something like
objPosX = new int[numOfItems];

Oops… I ran into that problem before. How could I have forgotten. Thanks.