adding a control to toolbar

  • Thread starter Thread starter Ohad Young
  • Start date Start date
O

Ohad Young

Hi,

Is there a way to host a control other then button in a toolbar control (VS
..NET 2003, .NET FRWK 1.1)?
What I wanted to do is to use the free space, not used by the toolbar to
display buttons, to display other information, for example in a textbox. Is
it possible?

Ohad
 
You can simply modify the Designer Generated code to add the control to the
Toolbars Controls collection instead of adding it to the Forms Controls
collection.

'Me.Controls.Add(Me.TextBox1)
Me.ToolBar1.Controls.Add(Me.TextBox1)

If you need to add controls between buttons you can put another toolbar
inside the toolbar and use Anchor properties on that instead of Docking it.

This is not really the ideal solution, but it works.
 
Hi Mick,

Thanks for your quick answer.
I tried it but with no success.
I got the following error when switching back to the designer mode:
"At least one element in the source array could not be cast down to the
destination array type."

Any ideas?

BTW, what I did for now is to group the controls I wanted to add in a
panel and locate it as if it is part of the toolbar (bring to front +
location settings).

Ohad
 
Back
Top