I am trying to link a PictureBox in Form1 with an image in my Resource file.
If I type it in like:
Code:
Dim pic1 As New Bitmap(My.Resources.h22)
PictureBox2.Image = pic1
It works fine. However, I won't know the name of the file to just type it in like that. The name is calculated and stored in a string. Here's what I came up with to display the picture:
Code:
Dim MyImagePlace As String = "My.Resources." & ImageString(0).ToString()
Dim pic1 As New Bitmap(MyImagePlace)
PictureBox2.Image = pic1
where MyImagePlace becomes My.Resources.h22
But it doesn't work. I get an error that the parameter is not valid. Why does that not display the image, and how can I modify it so it does? Thanks!