Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FileNotFoundException on MyProject.resources

I am trying to add an image to a button (C# Winform, VS2010). I have added the resource by Adding Existing Item in the Resources.resx file. I then assign my image to the button and all appears well. When i run my program i get:

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

Additional information: Could not load file or assembly 'BmsReplayAnalysis.resources, Version=1.0.0.0, Culture=en-US, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. 

in this code:

public static System.Drawing.Bitmap play1 {
    get {
        object obj = ResourceManager.GetObject("play1", resourceCulture); <-- DIES HERE
        return ((System.Drawing.Bitmap)(obj));
        }
    }

Can anyone tell me what i am doing wrong?

like image 315
Jason Avatar asked Mar 14 '26 13:03

Jason


1 Answers

When you just give it a name of a file, when you run it, it looks for it in the folder that it is running out of. If you are running in debug mode, it will look for play1 inside the debug folder. if its not there its an error.

like image 191
Grant Avatar answered Mar 17 '26 01:03

Grant



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!