Hidden resource files?

N

Nickneem

The following is driving me mad:

VS2005 Compact framework, project upgraded from 2003.

I get a cast exeception error trying to populate an imagelist (code is
by design)
Me.imgListDiv.Images.Clear()

Me.imgListDiv.Images.Add(CType(resources.GetObject("resource"),
System.Drawing.Icon))

Me.imgListDiv.Images.Add(CType(resources.GetObject("resource1"),
System.Drawing.Icon))

When I look in the forms resources (mainform.resx) - icons the icons
are all there nicely organized, recource, resource1, etc..
There are NO 'images' in the MainForm.resx

The project builds fine but when I debug the code hangs with a:

System.InvalidCastException was unhandled
Message="InvalidCastException"
StackTrace:
bij DigiWaiterPDA.MainForm.InitializeComponent()
bij DigiWaiterPDA.MainForm..ctor()
bij System.Reflection.RuntimeConstructorInfo.InternalInvoke()
bij System.Reflection.RuntimeConstructorInfo.Invoke()
bij System.Reflection.ConstructorInfo.Invoke()
bij System.Activator.CreateInstance()
at MyForms.Create__Instance__()
at MyForms.get_MainForm()
bij DigiWaiterPDA.MainForm.Main()

On the line:
Me.imgListDiv.Images.Add(CType(resources.GetObject("resource"),
System.Drawing.Icon))

When I try to retrieve the resource in the immediate window:
? resources.GetObject("resource")
{System.Drawing.Bitmap}
System.Drawing.Bitmap: {System.Drawing.Bitmap}
It shows me 'resource' (and resource1) are bitmaps while they're
supposed to be icons.

If I bind the resourcefile to an existing picturebox and save it on
the PDA (emulator) I can tell a .bmp which I used earlier in the
project is shown so I thought I'd try and delete all those images with
a 'build action' embedded resource' but all with no success though ;((

The 'Localizable' property of the form is false (at the moment,
because I really want the form to be localizable thus allowing multi-
langual).
Are there resource files outside the default forms and project
resource files?

Any help is much appreciated!!!

Kind regards,

Mike
 
N

Nickneem

I hate it when after searching hours and hours you find this one post
with the exact same problem just to see the question's never answered.

I didn't really find out where those unwanted, strange, hidden
resources came from.
I installed SharpDevelop to see if I could find out more with the
Resouce toolkit but that didn't change anything.
Finally I tried changing the root namespace and that seemed to do the
trick.

resources.GetObject("resource") 1, 2, 3, etc pointed to the right icon
file and not to the ghost bitmaps!

Mike
 

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