Hi
Ive currently got a problem with my code, its meant to step through the array and search the array. For some reason it only does the 1st line of array, it wont go through the rest of the array. The problem with that line of code is that it only searches the 1st line of the Array, and doesn't recognise when I search for all the other rows of the Array, theres only 10 rows in the array.
This is the code:
> {
> Console.WriteLine("Type in the First Name of the person you want to search:");
> string SearchInput5 = Console.ReadLine();
>
> for (int i = 0; i <= 10; i++) //10 is the number of rows in the 2D table-like array
> {
> for (int j = 0; j <= 2; j++)//2 is the number of columns in the 2D table-like array
> {
> if (AddressBook[i, j].Equals(SearchInput5, StringComparison.OrdinalIgnoreCase))// this line shows the error when I search for the 2n d line of the Array
> }
> }
> }
>
> I cant figure this out because it should be stepping through the whole array, it keeps coming up with an error when I search for another row of the array. This is the error:
> -IndexOutOfRangeException was unhandled.
> -Index was outside the bounds of the array.
Thanks for looking and helping me in advance.