0
Hello I have a table coming from the database, with several rows and columns. One of these columns is stored the address of the previously saved image. Now I need to go through all Picturebox and put in Imagelocation the address of that image. Oh, yes! Before I forget I have 10 Picturebox in the form. I’m using the following code:
foreach (Control item in this.Controls)
{
if (item is PictureBox)
{
item.Name.ToString();//Até aqui tudo certo, consigo ver nome dele, mas preciso pegar nome e a propriedade ImageLocation
}
Someone has an idea?
It means that you have a list of image addresses in DB and you want to upload these images in the respective picture-boxes?
– Miguel Angelo
What variable the database information is loaded into. You are using some ORM: Entityframework, Nhibernate?
– Miguel Angelo
@Miguelangelo is a Datatable type variable, and I’m going through the rows and columns using a for
– Fabrício Mendes
@Miguelangelo I’m using windows form C#.
– Fabrício Mendes
But then for every Row traveled from Datatable, you want to upload the image in the next available Picturebox... would be this?
– Miguel Angelo
@Miguelangelo That’s right. + or - like this: Picturebox1.Imagelocation = Table.Rows[0][0]. Tostring(); Picturebox2.Imagelocation = Table.Rows[1][0]. Tostring();
– Fabrício Mendes
@Fabríciosimonealanamendes See if any of the answers of that question help you.
– stderr
@Qmechanic73 my code is already like this, I would really like to do this didactic.
– Fabrício Mendes