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

Posted on 2009-12-17
Last Modified: 2013-12-17
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 ;-).
Question by:dannyhop
    LVL 41

    Expert Comment

    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:
    LVL 35

    Expert Comment

    by:Miguel Oz
    You need to build a custom-toolstrip that inherits from ToolStripControlHost:
    Another way to do it: (Just replace the datetime picker with your combobox)

    Author Comment

    I'll try these and let you know if it worked

    Author Comment

    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
    LVL 41

    Accepted Solution

    ToolStrip.Items is a collection.   That means you can use the .Insert() method to put it at the location you want.

    Author Closing Comment

    That did it.  I just replaced
    "toolStrip1.Items.Insert" , gave it the proper index... and shazam... works great.
    Thanks for your kind assistance grave.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
    In my previous two articles we discussed Binary Serialization ( and XML Serialization ( In this article we will try to know more about SOAP (Simple Object Acces…
    This video discusses moving either the default database or any database to a new volume.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now