Integrate a ComboBox into a C# .net2.0 ToolStrip

I am trying to integrate a ComboBox into a C# .net2.0 ToolStrip. (I am actually using  a custom ComboBox , that inherits from type  ComboBox).  It appears that the ToolStrip has specialized components (button, comboBox, etc).   The toolstripComboBox does not appear to have the same functionality  as a standard ComboBox.  I need the added functionality of the non-ToolStrip ComboBox. I am using it for a Font Selector which shows the graphical representations of the fonts
I would really like to add the ComboBox into the toolStrip.  Has anyone been successful at this?   I can place it at the end of the other combobox Items.  It appears to be part of the toolstrip but its not really integrated into the toolStrip.   I really would like to place it in the middle of the toolStrip and its not apparent how I could do this.
If I try to set the ComboBox parent to the ToolStrip I get a collection is read only error.  
Any ideas how I might make this work?  Or at least act like it works ;-).
Thanks
dannyhopAsked:
Who is Participating?
 
grayeConnect With a Mentor Commented:
ToolStrip.Items is a collection.   That means you can use the .Insert() method to put it at the location you want.
0
 
grayeCommented:
There is the "hard way"... where you create a class that inherts from ToolStripItem...  and the "easy way", where you just poke an existing control into the toolstrip.
Take a look at the following article for the easy way:
 http://kozmic.pl/archive/2007/06/01/how-to-embed-custom-control-in-toolstrip.aspx
0
 
Miguel OzSoftware EngineerCommented:
You need to build a custom-toolstrip that inherits from ToolStripControlHost:
http://bytes.com/topic/visual-basic-net/answers/601299-building-custom-toolstrip-control
Another way to do it: (Just replace the datetime picker with your combobox)
http://kozmic.pl/archive/2007/06/01/how-to-embed-custom-control-in-toolstrip.aspx
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
dannyhopAuthor Commented:
I'll try these and let you know if it worked
Thanks
0
 
dannyhopAuthor Commented:
I am half way there.  Using the 'how-to-embed-custom-control-in-toolstrip' article,  I can place the item in the toolstrip but only at the end.  It looks like the order of apperance in the toolStrip is established in the forms designer .cs file.   I do not see how to specify its order within the toolstrip.  Is there anything that I can do to control the order of apperance of this item within in the toolStrip.
Thanks Again
0
 
dannyhopAuthor Commented:
That did it.  I just replaced
"toolStrip1.Items.Add"
with
"toolStrip1.Items.Insert" , gave it the proper index... and shazam... works great.
Thanks for your kind assistance grave.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.