Win32 Exception

  • Thread starter Thread starter Jake Pearson
  • Start date Start date
J

Jake Pearson

Hi,
I am getting an exception when I read in bunch of resources with the
following code:

string fullName = name + ".ico";
Stream stream = assembly.GetManifestResourceStream(fullName);
return new Icon(stream);

The stack trace is as follows:

Unhandled Exception: System.ComponentModel.Win32Exception: Element not
found
at System.Drawing.Icon.Initialize(Int32 width, Int32 height)
at System.Drawing.Icon..ctor(Stream stream)

It seems to only happen when I read the same resource again and again.
I was able to fix the error by caching the resource, but I was still
curious why it happens. Any ideas?

thanks,
Jake Pearson
 
Jake-

Try adding the name of the default namespace to the beginning of the string:

string fullName = "NameSpace." + name + ".ico";

Robert
 

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

Back
Top