A question about "Resources"

  • Thread starter Thread starter Nurchi BECHED
  • Start date Start date
N

Nurchi BECHED

Hello, All

My question is, if I add an image to my project
and make it embedded resource, how do I access
that image (or any other object, down the road)
in runtime?

Thanks.
I appreciate your help.
 
Nurchi said:
Hello, All

My question is, if I add an image to my project
and make it embedded resource, how do I access
that image (or any other object, down the road)
in runtime?

Thanks.
I appreciate your help.

Look into the GetExecutingAssembly and GetManifestResourceStream
methods...you can use them to pull out the embedded resources in your DLL.

HTH...
Chris
 
Thank you very much.
I appreciate your help.

If anyone is interested, the following is how to do what I asked:
this.Image2Show.OutImg=new Bitmap(
Assembly.GetExecutingAssembly().
GetManifestResourceStream(
"NurchiScreenSaver.Image.jpg"));

After some research on the net, I found where my problem was:
In C# (but not in VB) the project name MUST prepend the filename.
In my case this is "NurchiScreenSaver", and the filename is "Image.jpg"
which is embedded resource in my project.

Thanks again for some ideas, as I had no idea where and what to look for.
Have a nice day.
 
Back
Top