[RESOLVED] FileNotFoundException
Does this code look ok to you?
Code:
pictureBox1.Image = System.Drawing.Image.FromFile("..\\MyNewProject\\Resources\\Adhesive.jpg");
Here is the file path from Windows:
C:\Documents and Settings\D. Murphy\My Documents\Visual Studio 2008\Projects\Project1\MyNewProject\MyNewProject\Resources\Adhesive.jpg
I've tried about twenty variations of the file path in my command so far and can't seem to get it....
The Project Solution file is in:
C:\Documents and Settings\D. Murphy\My Documents\Visual Studio 2008\Projects\Project1\MyNewProject
Re: FileNotFoundException
if the file is included in the resource, you can retrieve it like
Code:
pictureBox1.Image = Properties.Resources.Adhesive;
Re: FileNotFoundException
Quote:
Originally Posted by
dannystommen
if the file is included in the resource, you can retrieve it like
Code:
pictureBox1.Image = Properties.Resources.Adhesive;
But you cannot only using windows to copy it into the resources file, you need to add it to the resources using Visual Studio before you can use it.
Re: FileNotFoundException
Thankyou both very much. I had been trying it using the resource first, and couldn't get it working from code, so I switched to trying to reference the file directly. Its working now. :)
Re: [RESOLVED] FileNotFoundException
Johnny, thanks for your articles by the way, the dockable panels one is excellent.