" provides strongly-typed access to the resources in your project. It has a property for each file embedded in the resources, but it doesn't provide an indexer to access the files with a dynamic name.
However, it does
provide a property called
, which will let you access the resources by name:
Retrieving Resources with the ResourceManager Class
Protected Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim button As Button = DirectCast(sender, Button)
Dim resource As Object = My.Resources.ResourceManager.GetObject(button.Text)
Picturebox1.Image = DirectCast(resource, Image)
You only need the name of the resource, not the file extension.