how to convert a string to variable without making its copy and modifying it

  • Thread starter Thread starter question_asker
  • Start date Start date
Q

question_asker

Guest
i have about two hundred variable of picturebox in windows forum now i want to convert it to array

the variabes looks like

pictureBox1,pictureBox2,pictureBox3,........pictureBox200

if there is another algo of making of these picureboxes to make an array without making them in design tab then please help

void convert_to_coins()
{
for (int i = 0; i < 180; i++)
{
string x = ("pictureBox" + i);
(x)pictureBox = arr;

}
}



but it isn't working

pictureBox1
pictureBox1


or like this

pictureBox[] arr=new pictureBox[200];
int i=0;
foreach (Control x in this.Controls)
{
if (x is PictureBox && x.Tag == "wall")
{

x.Tag = "coin";
arr=x;
i++;
}
}


please help me i am bigginer

Continue reading...
 
Back
Top