title: Visual C++ picturebox naming with a variable
body: <p>I am creating a Battleship game for a class and have a grid of picture boxes layed out as the board.</p>
  
  <p>I am wondering if there is any way I can refer to the picture box as a variable so I can iterate through them using a loop.</p>
  
  <p>Naming scheme is pA1-pA10 for column1, pB1-pB10 for column2 etc through column 10.</p>
  
  <p>What I am needing to do is figure out a way to put this function in a loop so it can iterate through the list without having to have this code for each picture box.</p>
  
  <p>This code is what is used to check what value is stored in the array and load the correct image into the picturebox.</p>
  
  <pre><code>    if (pIsShip(0, 0)=='s')
      {
          pA1-&gt;Load("Ship.png");
      }
      else if (pIsShip(0, 0) == 'w')
      {
          pA1-&gt;Load("Water.png");
      }
      else if (pIsShip(0, 0) == 'h')
      {
          pA1-&gt;Load("Hit.png");
      }
      else if (pIsShip(0, 0) == 'm')
      {
          pA1-&gt;Load("Miss.png");
      }
  </code></pre>