i m creating a win form application in which i have a tabcontrol1, and at run time created tabpage and pictureboxon a button click i make new tab page and picture boxand add them to the tabcontrol1. now i can change image of only last created picture box...and when i try to change the image of any picture box except the last one, i am not able to do that this is the code example button1 creates new tabpage and picturebox Collapse | Copy Code private void button1_Click(object sender, EventArgs e)
{
TabPage tpgallery = new TabPage();
tpgallery.Name = "tpgallery";
tpgallery.Text = " Gallery ";
tabControl1.TabPages.Add(tpgallery);
picturebox1 = new PictureBox();
picturebox1.Name = "picturebox1name";
picturebox1.Image = WindowsFormsApplication7.Properties.Resources.logo1;
tpgallery.Controls.Add(picturebox1);
}
button2 changes image of picturebox Collapse | Copy Code private void button2_Click(object sender, EventArgs e)
{
picturebox1.Image = WindowsFormsApplication7.Properties.Resources.logo2;
}