VB.Net: Dynamically Select Image from My.Resources

Jeff picture Jeff · Jul 27, 2009 · Viewed 105.2k times · Source

I have a group of images in my My.Resources. I want to select select images to display dynamically at run time. How do I do this?

'Static (Compile time) Assignment
UltraPictureBox1.Image = my.Resources.zoo_picture_1

'Dynamic (Runtime) Assignment
UltraPictureBox1.Image = ???

Answer

Jeff picture Jeff · Jul 27, 2009

Found the solution:

UltraPictureBox1.Image = _
    My.Resources.ResourceManager.GetObject(object_name_as_string)