Nested For loop multidimensional array search
<p>Got a silly question im struggling with.</p>

<p>Im trying to step through a C# Multidimensional array using nested for loops, but i cant get the result i want and im thinking its just a stupid problem with my code.</p>

<pre><code>string search = txtString.Text;

        int iLoop;
        int jloop;
        int iResult = -1;

        for (iLoop = 0; iLoop &lt; sounds.GetLength(0) ; iLoop++)
        {
            for (jloop = 0; jloop &lt; sounds.GetLength(1) ; jloop++)
            {

                string result;
                result = sounds[iLoop,jloop];

                if (result == search)
                {
                    iResult = iloop;
                }
            }
        }

            if (iResult == -1)
            {
                MessageBox.Show("Result not found");
            }
            else
            {
                MessageBox.Show("Result found at position " + iResult);                    
            }            
    }
</code></pre>

<p>It searches the array, and returns a positive result if the answer is found, but the result position is always "Result found at position 1".</p>

<p>What have i done wrong?</p>
