הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
Question
Wednesday, May 31, 2006 9:05 PM
-Visual Basic Express 2005-
I have a resource file and have included all my images into. I need to load hundred.jpg into a picurebox when a certain event occurs. I hope to get the simplest line of code possible to do this
Can anyone please help??? Thanks in advance :)
All replies (8)
Thursday, June 1, 2006 12:01 AM ✅Answered
This should work.
PictureBox1.Image = My.Resources.<Name_of_res_file>.<Name_of_image_resource>
Wednesday, May 31, 2006 9:33 PM
this.pictureBox1.Image = Properties.Resources.Image_Name [C# Code], i think it is same for VB
Wednesday, May 31, 2006 11:23 PM
PictureBox1.ImageLocation = "C:\Documents and Settings\Owner\My Documents\Visual Studio 2005\Projects\Project Name\Project Name\Resources\hundred.jpg"
The italicized Project Name should be replaced with the name of your project file, as should PictureBox1 be replaced with the name of the picture box.
I pulled all of this from memory, so if the above doesn't work, let me know and I'll find out what the correct code is.
Thursday, June 1, 2006 12:39 AM
Thank you very much Jayson. :) This was exactly what I was looking for.
Thursday, June 1, 2006 12:47 AM
You are welcome and great coding.
Monday, September 25, 2006 3:03 AM
Hello,
Can someone please tell me how to create a "Resource File" in VB.net 2003 and VB.net 2005? I have been trying to figure this thing out for a week now. There is no good documentation on it. I understand the code for including pictures from the resource file in the application as code, I just need to figure out how to add the resource file to the application.
Thank you.
Monday, June 18, 2007 2:59 AM
If you need to use it to store pictures you should just add a folder called images and put your images in it. Then you can drag and drop the image to anywhere on your page. When you publish your site, you'll have a folder called images with them in it. Does this answer your question?
Thursday, January 15, 2009 5:18 PM
thanks a lot jayson! now i can put images randomly from resources, i dont have to send people a folder that has the pictures.