You can't to that
box strBoxName = new box(xPos,yPos,boxName,false);
This will create a variable named strBoxName, which will have nothing to do with the string strBoxName. So, when your loop gets to this line for the second time, you get the error since strBoxName is already defined by the first iteration of the loop.
May I suggest, use a 2D array of box objects and each time, create a new box at [verCounter][horCounter].
cheers