C
C#16mo ago
AideedSS

❔ ✅ How to get ImageLocation from Controls?

lets say
PictureBox pb = new PictureBox();
pb.ImageLocation = "....";

panel1.Controls.Add(pb);
PictureBox pb = new PictureBox();
pb.ImageLocation = "....";

panel1.Controls.Add(pb);
and then, I want to retrieve ImageLocation..But with panel1.Controls.. soo
var imageLocate = panel1.Controls[0].ImageLocation;
var imageLocate = panel1.Controls[0].ImageLocation;
ImageLocation definition arent available..How to make code able to identify that panel1.Controls[0] is a PictureBox, so I could retrieve ImageLocation?
2 Replies
AideedSS
AideedSS16mo ago
nvm I got it In case if you're wondering how?
PictureBox pb = (PictureBox)panel1.Controls[0];

string src = pb.ImageLocation;
PictureBox pb = (PictureBox)panel1.Controls[0];

string src = pb.ImageLocation;
Accord
Accord16mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.