Bug in Windows Form Designer generated code (VS.NET 2003)

A

Alek Davis

Every time I make a change affecting a toolbar (e.g. adding or removing
buttons), I loose the bitmap images at runtime. They are still displayed in
the designer, but when the application runs, the toolbar appears blank with
only separators visible. I determined that the problem is caused by the
wrong location of the toolbar.Buttons.AddRange function in the
auto-generated InitializeComponent function, which is placed before buttons
are initialized. If I manually move the AddRange function call after the
button initialization calls, it works fine, but the next time I make a
change, I have to do it again. This is really irritating. Is this a known
bug? Is there a fix for it? A better workaround? Thanks.

Alek
 
H

Herfried K. Wagner [MVP]

* "Alek Davis said:
Every time I make a change affecting a toolbar (e.g. adding or removing
buttons), I loose the bitmap images at runtime. They are still displayed in
the designer, but when the application runs, the toolbar appears blank with
only separators visible. I determined that the problem is caused by the
wrong location of the toolbar.Buttons.AddRange function in the
auto-generated InitializeComponent function, which is placed before buttons
are initialized. If I manually move the AddRange function call after the
button initialization calls, it works fine, but the next time I make a
change, I have to do it again. This is really irritating. Is this a known
bug? Is there a fix for it? A better workaround? Thanks.

I am not able to repro that. Which version of VS.NET do you use? Are
you using Windows XP Visual Styles?
 
D

Doug Forster

Hi Alek,

The form designer is full of bugs of this nature (losing properties) that
seem to happen consistently with particular forms but with no obvious
pattern (to us anyway). Our usual solution is to move the incorrect or
missing code into the form constructor after the call to InitializeComponent
and forget about being able to design that particular aspect of the form.

Cheers

Doug Forster
 
A

Alek Davis

I am using VS.NET 2003 v. 7.1.3008, Framework 1.1.4322, XP SP 1 (not sure
what visual styles are, so I guess I do not use them).

Alek
 
A

Alek Davis

Thanks for the suggestion Doug. I will see if I can do something similar.

Alek
 

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