i have a database from which i count the total no of entries and create a loop for the count and for each count i need to show a piturebox with an image 2.jpg i having problems. Please help
Create piturebox at runtime
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Bechir BejaouiRank #144 · 15.9K reputationPosted Jun 24, 2008, 1:25 PM EDT
imageList.images[index]
utsav rathour52 reputationPosted Jun 24, 2008, 6:50 PM EDT
Well the list count is 5 from my table and want to use array.
something like.
picturebox [] a= new picturebox[20];{
for(i=0;i
a[i].image = image.fromfile(application.startupath+"\\a.jpg");
a[i].location = "position";
}
-------------
But it is not working what do i do?
Jan MontanoRank #1,295 · 1.3K reputationPosted Jun 24, 2008, 9:51 PM EDT
private void button5_Click(object sender, EventArgs e)
{
PictureBox[] a = new PictureBox[5];
int x = 5;
int y = 5;
for (int i=0; i<5; i++)
{
y += 60;
a[i] = new PictureBox();
a[i].Image = Image.FromFile(@"C:\Documents and Settings\Default User\My Documents\My Pictures\sample.jpg");
a[i].Location = new Point(x, y);
this.Controls.Add(a[i]);
}
}