1 Attachment(s)
[RESOLVED] how to access files added to the project?
Hi folks.
In the solution explorer I have created a pics folder, then added files to the folder. I could use "Me.PictureBox1.ImageLocation = path" for pic files that have not been added to the project. But now that the files are added to the project, is there a way of accessing them directly? For example "Picturebox.Load(1.jpg)". Is there any difference in how files are accessed whether they are part of the project or not?
Thanks in advance.
Re: how to access files added to the project?
Add them to your resources. To do so:
1) Double-Click 'My Project' in the Solution Explorer
2) Click on the resources tab in the left hand column
3) Change the 'Strings' drop-down box to 'Images'
4) Click on the arrow for the 'Add Resources'
5) Click on add existing files
To access the images you'd set the picturebox like this:
Code:
PictureBox1.Image = My.Resources.1
Re: how to access files added to the project?
Thanks dday9.
I followed all the steps, and the image file is added as _1.jpg in the resources window(even though in solution explorer it shows as 1.jpg). Then intellisense completes the statement as "PictureBox1.Image = My.Resources._1", and the picture does not load in the picturebox.
I can use the properties window to choose the image as a project resource and the image loads fine. "PictureBox1.Image = My.Resources.1" results in an error message, "PictureBox1.Image = My.Resources._1" does not, but the image doesn't load.
Re: [RESOLVED] how to access files added to the project?
Ok, works now. I had accidentally put the statement in the picturebox's click event handler, so no image is displayed until I click on it. :D
Thanks for your help dday9!