I have an array like this that saves queries as the user moves forward:
String [,] qArr=new String[2,6];
I have a button for each of those 6 rows in the array.
Here is what I want to do:
If the user is at step 4 (button 4 and so 8 queries saved), now clicks on button 2, then I want to delete any query after row 2 in the array.
Here is what I have done:
public void remQ(int position) //position is the row starting from 0
{
position=(position+1)*2;
Array.Clear(qArr,position,qArr.Length);
}
Error1: Here is what I get when I run this:
Index was outside the bounds of the array
Debugging shows these values:
qArr=string[2,6]
d=4
qArr.Length=12
How do i fix this?
string [6,2]would probably exhibit the behaviour that you want.