Click here to Skip to main content
Click here to Skip to main content

The Ultimate Toolbox Multi Combobox

, 25 Aug 2007 CPOL
Rate this:
Please Sign up or sign in to vote.
A flexible multi-column combobox control from the Ultimate Toolbox

Visit the Ultimate Toolbox main page for an overview and configuration guide to the Ultimate Toolbox library.

Source code and project files for this sample can be found in the samples\gui\MultiCombo directory of the sample projects download.


The COXMulticomboBox class is derived from MFC's CComboBox and implements a combo box with more than one column. A version of this type of control can be seen in action in Microsoft Access.


  • Can have multiple columns in each item of the combo box.
  • Only one column will be transferred to the edit (or static) control. The other columns are shown in the dropdown listbox as extra information.
  • The interface is identical to CComboBox with an extra column number parameter.


The ComboBox should be created as CBS_OWNERDRAWFIXED. If you want variable height rows you can use CBS_OWNERDRAWVARIABLE, but you will need to handle the MeasureItem notification yourself. If you don't specify CBS_HASSTRINGS, you have to handle the DrawItem and CompareItem methods and maintain each column items data yourself.

If the COXMultiComboBox is used as a control in dialog box then set the above said (ownerdrawn) styles in the dialog templates.

In the header of your MFC CDialog derived class, you can subclass a CComboBox member variable set by the Class Wizard by simply replacing the class name in the declaration in the AFX_DATA area.

The code from the samples\gui\MultiCombo:

#include "OXMultiComboBox.h"

#include "UTB64Bit.h"


// CMComboDlg dialog

class CMComboDlg : public CDialog
// Construction

    CMComboDlg(CWnd* pParent = NULL);    // standard constructor

// Dialog Data


    enum { IDD = IDD_MCOMBO_DIALOG };
    COXMultiComboBox m_MCombo;

All that's needed is a bit of initialization in OnInitDialog:

    LPTSTR str1[] = {_T("David"), _T("Cunningham"),
    LPTSTR str2[] = {_T("Troy") , _T("Marchand"),  
    LPTSTR str3[] = {_T("Andrei"), _T("Zenkovitch"), 
    LPTSTR str4[] = {_T("Ghazi"), _T("Wadi"), 

The compiled HTML help documentation contains a complete COXMulticomboBox class reference.


Initial CodeProject release August 2007.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

The Ultimate Toolbox
Web Developer
Canada Canada
In January 2005, David Cunningham and Chris Maunder created, a new group dedicated to the continued development, support and growth of Dundas Software’s award winning line of MFC, C++ and ActiveX control products.
Ultimate Grid for MFC, Ultimate Toolbox for MFC, and Ultimate TCP/IP have been stalwarts of C++/MFC development for a decade. Thousands of developers have used these products to speed their time to market, improve the quality of their finished products, and enhance the reliability and flexibility of their software.
Group type: Organisation

394 members

Comments and Discussions

QuestionSource code is missing PinmemberFlaviu225-Mar-14 22:02 
QuestionVertical scrollbar can not show correctly. Pinmembermaplewang24-Mar-14 21:34 
QuestionShows up incorrectly on second monitor Pinmemberpeon123416-Sep-09 9:36 
AnswerRe: Shows up incorrectly on second monitor PineditorTim Deveaux16-Sep-09 11:30 
GeneralRe: Shows up incorrectly on second monitor [modified] Pinmemberpeon123416-Sep-09 13:29 
GeneralRe: Shows up incorrectly on second monitor PineditorTim Deveaux16-Sep-09 14:09 
Generaldocumentation (chm file) not found Pinmembermensoeng21-Oct-08 1:19 
GeneralRe: documentation (chm file) not found PineditorTim Deveaux21-Oct-08 7:38 
GeneralMissing column headers Pinmemberjsumm28-Mar-08 12:33 
GeneralRe: Missing column headers PineditorTim Deveaux28-Mar-08 15:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141220.1 | Last Updated 25 Aug 2007
Article Copyright 2007 by The Ultimate Toolbox
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid