ToolBar Bug in the Visual Studio .NET 2003 Windows Forms designer (with workaround)

If you have a toolbar on a form and it’s images show up fine in design mode, but show up blank when you run your program, it’s probably because of this problem.


It seems when the designer writes out the code to create the objects on the form, it writes out the code to add the buttons to the toolbar before initializing the buttons.  I think this should be okay, but apparently it’s not – this leads to the buttons being blank.


An easy workaround is to call toolbar.Buttons.Clear() and then toolbar.Buttons.AddRange() again after the InitializeComponent() call returns.