Windows Form color changing
<p>So i am attempting to make a MasterMind program as sort of exercise.</p>

<ul>
<li>Field of 40 picture boxes (line of 4, 10 rows)</li>
<li>6 buttons (red, green, orange, yellow, blue, purple)  </li>
</ul>

<p>When i press one of these buttons (lets assume the red one) then a picture box turns red.<br>
<strong>My question is how do i iterate trough all these picture boxes?</strong><br>
I can get it to work but only if i write :<br>
And this is offcourse no way to write this, would take me countless of lines that contain basicly the same.</p>

<pre><code>        private void picRood_Click(object sender, EventArgs e)
    {
        UpdateDisplay();
        pb1.BackColor = System.Drawing.Color.Red;
    }
</code></pre>

<p>Press the red  button -> first picture box turns red<br>
Press the blue button -> second picture box turns blue<br>
Press the orange button -> third picture box turns orange<br>
And so on...</p>

<p>Ive had a previous similar program that simulates a traffic light, there i could assign a value to each color (red 0, orange 1, green 2).<br>
Is something similar needed or how exactly do i adress all those picture boxes and make them correspond to the proper button.   </p>

<p>Best Regards.</p>
