VB.NET Designer Issue with PictureBox Control

Xyline 6 Reputation points
2022-07-25T15:09:23.597+00:00

224493-image.png

I am getting this error after I had to do a One Drive backup and files were moved around and some renamed. If I go to the line of code shown in the image above in mParent.Designer.vb, it is "Me.PictureBox1.Image = Global.UL_Report_Builder.My.Resources.LogoB_W" that is the problem. I can comment out that line of code and the "mParent.vb [Design]" window will show but the PictureBox will show no image. I can't even set the property of the PictureBox to an image from my resources. But I can run the program with the previously mentioned line of code and the program will run as normal with the image rendered in the PictureBox. I have spent some time trying to solve this issue so I don't have the error in the above image. This is happening to all the Forms in my project that use an image from my resources to set the PictureBox image property.

I thought it may have been the "My Project.Resources.resx" file having the wrong filepaths but nothing I did helped solve the problem. Maybe there is a way to rebuild the Resources.resx file? I deleted the PictureBox and made a new one but I still get the same issue. I may have not given enough information about the issue so let me know if any additional information would be needed. Any help would be very much appreciated!

Developer technologies | Windows Forms
Developer technologies | VB
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Reza Aghaei 4,986 Reputation points MVP Volunteer Moderator
    2022-07-25T16:05:56.09+00:00

    Assuming we are talking about PictureBox1 and Form1, the easiest fix would be re-assigning the image:

    1. Close all files
    2. Form1.Designer.Vb file in text editor. (It's under Form1 in solution explorer; if it's not visible, then click on show all files button (224438-image.png) on property browser toolbar to show it.)
    3. Remove the line of code which is setting the image in Form1.Designer.Vb file
    4. Save the Form1.Designer.Vb file
    5. Close VS
    6. Delete bin and obj folders
    7. Reopen VS
    8. Rebuild the solution
    9. Open Form1.Vb in design mode, and you see PictureBox doesn't have any picture assigned.
    10. Select the picture box, and set the Image property using the property browser.
    11. Save the form
    12. Run the project.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.