Nasty Error

  • Thread starter Thread starter Boas Enkler
  • Start date Start date
B

Boas Enkler

Hi

I've an Application on my PocketPC Running.

Everything worked fine for weeks. Now I wanted to try some installation
things. and the program doesn't start anymore

these lines of code are producing the error

InitializeComponent();
Icon icon;
icon = new
Icon(this.GetType().Module.Assembly.GetManifestResourceStream("smartCRMPDA13.ico.remote.ico"));
try
{
// Here it Crashes! The Icon is set as embedded source and when I
// COpy the application folder to an other PPC everything works fine!

this.ImageList16px.Images.Add(icon);
}
catch(Exception oErr)
{
// The Exception only says "Exception"....
program.ShowMessageBox(oErr.Message,"Fehler",2);
}


So any hints? I've absolutly no Idea whats going wrong here....
 
I've forgotten something to mention.

Since this error occurs the OpenNETCF(1.4) keeps reinstalling everytime I
start the app with my debugger, what it didn't since 1.4.
 
Am Wed, 23 Nov 2005 15:35:55 +0100 schrieb Boas Enkler:
Finally I found the solution but I don't know why it worky now nor why it
has worked before....

On the Forms I've a toolbar and a imagelist.

In the designer I assign the imagelist to the toolbar.
After the initialize components method I dynamically add images to the
control and thats where it fails.

when I change the assignment in the designer to empty and then only assign
the imagelist _after_ all icons werer dynamically added then everything
works fine.

So why does it behave like this?
 
Not sure if this is the fix but I had a problem that suddenly surfaced RIGHT
AFTER the initializecomponent() in my pda app. There is a 32k limit on the
size of the method code in .net cf. My problem occurred just after I added a
new object to my pda screen. When I cut some of the code from
initializecomponent() and created a new method, PseudoInitializeComponent(),
and pasted the code in, then called PseudoInitializeComponent() right after
the initializecomponent(), all my problems went away.
 
I think the program behavior is perfectly logical as this rule was
place even in VB6 that once the imagelist has been assigned to a
control, then images can not be added to or removed from it.
 
Back
Top