title: Changing properties of the sender object without knowing its name
body: <p>I am trying to change the BackColor of a PictureBox in a grid. The PictureBox is part of an array and the array has a chared event handler. I am having difficulty changing different PictureBox's depending on which one is clicked.</p>
  
  <p>This is what I have so far:</p>
  
  <p><code>        private PictureBox[,] GameGrid = new PictureBox[20, 20];</p>
  
  <pre>    public frmGame()
      {
          int x = 10;
          int y = 10;
          for (int i = 0; i &lt; 20; i++)
          {
  
              for (int j = 0; j &lt; 20; j++)
              {
                  GameGrid[i, j] = new System.Windows.Forms.PictureBox();
                  setUpPicBox(x, y, i, j);
                  x += 11;
              }
              y += 11;
              x = 10;
          }
          InitializeComponent();
      }
  
  
      public void setUpPicBox(int x, int y, int i, int j)
                  {
                      this.GameGrid[i, j].Location = new System.Drawing.Point(x, y);
                      this.GameGrid[i, j].Size = new System.Drawing.Size(10, 10);
                      this.GameGrid[i, j].BackColor = Color.Black;
                      this.GameGrid[i, j].Name = "btnGrid" + i + "-" + j;
                      this.GameGrid[i, j].Visible = true;
                      this.GameGrid[i, j].CreateGraphics();
                      this.GameGrid[i, j].Click += new System.EventHandler(this.picturebox_Click);
                      this.Controls.Add(GameGrid[i, j]);
                  }
  
      private void picturebox_Click(object sender, EventArgs e)
      {
  
      }&lt;/code&gt;
  </code></pre>
  
  <p>Any help would be appreciated</p>