get resource by string

icic

Member
Joined
Apr 9, 2006
Messages
16
Programming Experience
Beginner
Hello

I'm not very experienced in VB at all, but I was wondering if there was a way to achieve the following:

I have 15 pictures in the resources for my program, named:
Picture1.gif
Picture2.gif
Picture3.gif........

However, I would like for the program to automatically display a certain picture in a picture box based on a variable, for example I was thinking of something like this:

dim variable as integer
variable= (obtains vakue from somewhere)
picturebox.image=......picture[variable].gif

If it would be easy to type out a massive SELECT CASE statement, then just say; but I was hoping there might be a neater way....

Thanks!!
 
Here the get resource by string & variable:
VB.NET:
Dim int As Integer = 2
PictureBox1.Image = My.Resources.ResourceManager.GetObject("img" & int.ToString)
 
Back
Top