Question Variable Control Name?

riftmaster

New member
Joined
Oct 29, 2011
Messages
1
Programming Experience
1-3
Hi, I know this is a stupid question, so sorry in advanced :(


I have a few pictureboxes in a form named C1E1 to C5E3. I want to put pictures in them at runtume. I have a variable (Ename) that uses loops to update its value. now i have a line: Ename.Image = (IMAGE PATH)
however it produces a syntax error, anybody got any ideas?


thanks,
- Dan
 
You first need to look up the control from the controls collection by name, then cast that as type Picturebox to access the Image property.
CType(Me.Controls(ename), PictureBox).Image = path
 
Back
Top