Saturn
Saturn

Reputation: 18149

VB.NET: My.Resources.{VARIABLE}

So I can access an image by My.Resources.ImageName..........

But, that is manually-coded.

What I want is to have my image name saved in a variable, lets call it VAR. VAR = "IMAGE1.png"

So I can do something like

My.Resources.VAR which will return the IMAGE1.png image.

Is that possible?

Upvotes: 0

Views: 5870

Answers (2)

Tito Patiño
Tito Patiño

Reputation: 1

Declare:

Dim imag as Image
imag = My.Resources.foto
PictureBox1.Image = imag

That's it, the image (photo) will appear on the PictureBox1

Upvotes: 0

dbasnett
dbasnett

Reputation: 11773

My.Resources.ResourceManager.GetObject(var)

Upvotes: 4

Related Questions