VB.net PictureBox Error

Murray Brown
Murray Brown used Ask the Experts™
on
Hi

I have several PictureBoxes on a Windows form. For aech I import an image that gets loaded into resources. Sometimes I have to change the image in one of the PictureBoxes so I import a different image.
I then go and delete the image that I had previously used from resources and this causes errors. I don't understand why this happens and how do I prevent this
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
What errors? Where do the errors occur?
Murray BrownASP.net/VSTO Developer

Author

Commented:
Hi
I get the error "Invalid resx file. Could not find file 'C:\........\Resources\Pic1.png',Line 204,Position 5

and this occurred because I orginally imported the image by clicking on the image property of my picture box. Then I decided that I wanted to change to the picture to pic 2, which I imported. I then right clicked on Resources under my project and deleted Pic1, which resulted in the error
Try re-building your project.

Wayne
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

Murray BrownASP.net/VSTO Developer

Author

Commented:
 Hi. That didn't help. When I click on the error it takes me to the following line. The SortByProduct.png image is the one I deleted

<data name="SortByProduct" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>..\Resources\SortByProduct.jpg;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
  </data>
Go to your Project Properties > Resources tab, and remove the offending file. All removing of resources should be done from there, not from the Soltuion Explorer.

Wayne
Murray BrownASP.net/VSTO Developer

Author

Commented:
Thanks wayne. That worked

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial