Tuesday, February 07, 2006

VB.NET Bug: Toolbar Buttons Show No Text or Images in run time, although they appear correct at design time

Solution:
1. Expand the "Windows Form Designer generated code" section in the code view of the form.
2. Find out following statement in intializecomponents. (Replace Toolbar with actual toolbar control name)

ToolBar.Buttons.AddRange(...);

3. Cut above single line statement and Paste that statement of code at the end, after all of the properties of that ToolBar control have been set. [IMP: If Image list is used then paste above line after imagelist code block]

This will solve the problem.

[IMP: adding new controls or events, cause the IDE to regenerate the code, so the statement that causes the problem returns to its original location. Therefore, every time that you build and test the application, check the code file to make sure that above statement has been moved at the end]

1 comment:

Anonymous said...

thanks this solution is working.

Visitor Count: