Load Image from My.Resources to a Picturebox (VB.NET)

my.resources, picturebox, vb.net

Solution

Try to convert it `ToBitMap()`

 PictureBox1.Image = My.Resources.Online_lime_icon.ToBitmap()

EDIT:

@user1615710 : My.Resources.Online_lime_icon doesn't have .ToBitmap. It only has .ToString.

That means you've `String` resource and I think it represents `fileName` with or without absolute path.

Try to print/show the content of `My.Resources.Online_lime_icon`

 Debug.Print(My.Resources.Online_lime_icon) 'or
 MsgBox(My.Resources.Online_lime_icon)

If it is real path then load the image via,

 PictureBox1.Image = Image.FromFile(My.Resources.Online_lime_icon)

Problem

I'm having trouble loading an image from My.Resources. I have already tried a no. of codes like....: `PictureBox1.Image = My.Resources.Online_lime_icon;` And `PictureBox1.Image = CType(My.Resources.ResourceManager.GetObject("Online_lime_icon"), Image)` but it would still return: ``` Picturebox1.Image = Nothing ```

Original source