views:

1673

answers:

1

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 = ???
+3  A: 

Found the solution:

UltraPictureBox1.Image = _
    My.Resources.ResourceManager.GetObject(object_name_as_string)
Jeff
Oh man they could have made the same code work in both situations! I mean, .NET is full of those things like "do not say it's "form1", call it "me" instead". They could simply have auto-correction or even better, compile the code in the same way. /rant
Camilo Martin
P.S.: This doesn't work for me (VB 2008)
Camilo Martin
P.S.: Update: sorry; works, but don't include extension!
Camilo Martin