C
C#10mo ago
Conner

Newly added resource cannot be used

In a WinForms project I am adding an image to the Resources.resx file. I am assigning this image to a picture box. It appears in the list that pops up when selecting the background image! As soon as I try to build, I get the error that Properties.Resources.ImageName does not exist. Checking the resx its still there.
5 Replies
Conner
ConnerOP10mo ago
pbx_Background.BackgroundImage = Properties.Resources.status_screen; Error CS0117 'Resources' does not contain a definition for 'status_screen' It is fixable, by manually adding the property to the Resource designer. But that seems unecessarily complicated for just adding a resource I wonder if this is a problem because the designer doesnt get updated correctly?
FestivalDelGelato
when something like this happens try cleaning and rebuilding, eventually closing and restarting vs, just in case
Conner
ConnerOP10mo ago
I did clean and rebuild Ill try to relaunch
FestivalDelGelato
if it doesn't work then you have either to share parts of the project or try making a reproducible sample
Conner
ConnerOP10mo ago
Restarting did not work. I cant really share the project. Dont really have time to make an example as well right now, sorry. My workaround works for now I found the issue. The access midifier was set to (Custom), which idk how that even happened? Setting it to public finally updated the Resources.Designer.cs file

Did you find this page helpful?