title: How to find pictureBoxes in the form and add specific EventHandler to them
body: <p>I want to have a picture album that when I click  any picture it goes to another form to edit that picture.</p>
  
  <p>Now I have some pictureBoxes in the form with the names like PB0, PB1, PB2,...</p>
  
  <p>and a method like this</p>
  
  <pre><code>private void msgShow(int id)
  {
      MessageBox.Show(id.ToString());
  }
  </code></pre>
  
  <p>when I add event handler to the two pictureBoxes like this</p>
  
  <pre><code>PB11.Click += new EventHandler((sender2, e2) =&gt; msgShow(3));
  PB12.Click += new EventHandler((sender2, e2) =&gt; msgShow(4)); 
  </code></pre>
  
  <p>when I click PictureBox1 (PB1) messageBox shows </p>
  
  <blockquote>
    <p>3</p>
  </blockquote>
  
  <p>and when i click PictureBox2 (PB2) messageBox shows </p>
  
  <blockquote>
    <p>4</p>
  </blockquote>
  
  <p>it was true since I added 18 new pictureBoxes and used this code to do that</p>
  
  <pre><code>for (int i = 0; i &lt;= 19; i++)
  {
      ((PictureBox)Form2.ActiveForm.Controls.Find("PB" + i, true)[0]).Click += new EventHandler((sender2, e2) =&gt; msgShow(i));
  }
  </code></pre>
  
  <p>now its wrong and when I click each pictureBox messageBox shows</p>
  
  <pre><code>20
  </code></pre>
  
  <p>but I want to show unique numbers for each PictureBox</p>