C
C#2y 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
AideedSSOP2y 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
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server