“String”类型的值无法转换为“System.Drawing.Image”

时间:2014-08-02 10:40:41

标签: vb.net string typeconverter

PictureBox1.Image = "WindowsApplication4.My.Resources.Resources._" & itemno.Text

嗨,我有一堆图片,全部编号从(1-100)开始,当用户在" itemno"中输入一个数字时在输入框中,picturebox1.image会相应更改。我如何实现上面代码示例中的内容?

1 个答案:

答案 0 :(得分:1)

您可以使用ResourceManager按名称获取资源。

PictureBox1.Image = DirectCast(My.Resources.ResourceManager.GetObject("name_of_image"), Bitmap)
相关问题