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

  • Thread starter Thread starter Alek Davis
  • Start date Start date
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
 
* "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?
 
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
 
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
 
Back
Top