How do I set a PictureBox image to an image from my resources?
(I tried this without success: pictuerbox.Image = "img_location";
)
Add Image ResourceIn Visual Studio, click the Project menu, and select Add Existing Item. Find and select the image you want to add to your project. In the Solution Explorer window, right-click the image file you just added to your project, and select Properties from the popup menu.
Click "Import", locate the folder where the background image is located, select the background image, click "OK", the background of control button is the selected image, and it is also imported into the Resource, if other controls are also needed, select it in the "Select Resource" dialog box(Figure 2).
If you loaded the resource using the visual studio UI, then you should be able to do this:
picturebox.Image = project.Properties.Resources.imgfromresource
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With