Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a ToolBar

Status
Not open for further replies.

PeteG

Programmer
Feb 23, 2001
144
GB
Hi,
I'm having trouble getting a custom toolbar to appear on my form.

I have declared a new toolBar, 2 new ToolBarButtons, an ImageList and 2 new Icons.

I've added the images to the imagelist, set the imageindex of the toolbarbuttons to 0 and 1, set the imagelist to the toolbars imagelist property, added the buttons to the toolbar and set the toolbars location and size.

Then I've added the ToolBar to the forms Controls collection and made it visible.

All I see when I start it is a piece of the form changing colour - this piece is 'toolbar -shaped' so I assume it is the toolbar but it has no images or anything inside it.

Is there anything obvious missing here?

As you may have gathered, I'm new to C# so I'd appreciate any advice.

Cheers

Pete
 
Post your code m8
look at

Answer this aswell
is the toolbar ok at design time IF SO THE SOLUTION below will sort it out
SOLUTION:
=============
1. Go to your code editor
2. Open up the section where the code is generated by the IDE
3. Go to the section: "private void InitializeComponent()"
4. Look for the toolBar.Buttons. Addrange function, cut and paste the entire function to the bottom of the tool bar button section

NOTE: This bug is an annoying bug. Becasue the code is regenerated everytime you add things to the DESIGNER, before running
your program, make sure that the button.AddRange function has been moved to the bottom
 
Thanks - I just solved this this morning. I was creating my own UserControl class, creating a toolbar within that class and then creating an instance of the usercontrol in a form class.

However, I hadn't added the toolbar to the usercontrol Controls collection - so it didn't show.....

Thanks anyway

Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top