resource not found error

T

Trevor

I've got a bitmap file I want to use as a resource for an application. I
went to the project, added and existing item (the bitmap), and then set it
to embedded resource. When I run the app, I get the error:

An unhandled exception of type 'System.ArgumentException' occurred in
system.drawing.dll
Additional information: Resource 'skin.bmp' could not be found in class
'CodeTrue.Sales.SalesForm'.

the code is simply:
this.BackgroundImage = new Bitmap(GetType(), "skin.bmp");

Oddly enough, I use this same bitmap (a copy of the file) in another
project, and the same code works fine, so there must be something else that
I'm missing. Any help on this would be great.

Thanks,
Trevor B
 
C

Champika Nirosh

To where u add to image resource is it under the name space
"CodeTrue.Sales.SalesForm" or is it some where else..

I guess you may have add it to the root...

just to clarify try.. typeof(CodeTrue) instead of GetType() and see

I don't think that the problem is with the btimap itself .. I think the
problem is with the location you are asking the app to look for the image..

Nirosh.
 
T

Trevor

This didn't help. I think the framework knows where to look, because the
error tells me it can't find it in CodeTrue.Sales.SalesForm.
But, for some reason, it's like the bitmap isn't getting embedded properly
into the EXE.

Thanks,
Trevor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top