Click here to Skip to main content
13,894,020 members
Click here to Skip to main content
Add your own
alternative version


19 bookmarked
Posted 24 Aug 2007
Licenced CPOL

The Ultimate Toolbox Multi Combobox

, 25 Aug 2007
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

458 members

You may also be interested in...

Comments and Discussions

QuestionSource code is missing Pin
_Flaviu25-Mar-14 21:02
member_Flaviu25-Mar-14 21:02 
QuestionVertical scrollbar can not show correctly. Pin
maplewang24-Mar-14 20:34
membermaplewang24-Mar-14 20:34 
QuestionShows up incorrectly on second monitor Pin
peon123416-Sep-09 8:36
memberpeon123416-Sep-09 8:36 
AnswerRe: Shows up incorrectly on second monitor Pin
Tim Deveaux16-Sep-09 10:30
memberTim Deveaux16-Sep-09 10:30 
GeneralRe: Shows up incorrectly on second monitor [modified] Pin
peon123416-Sep-09 12:29
memberpeon123416-Sep-09 12:29 
GeneralRe: Shows up incorrectly on second monitor Pin
Tim Deveaux16-Sep-09 13:09
memberTim Deveaux16-Sep-09 13:09 
Generaldocumentation (chm file) not found Pin
mensoeng21-Oct-08 0:19
membermensoeng21-Oct-08 0:19 
GeneralRe: documentation (chm file) not found Pin
Tim Deveaux21-Oct-08 6:38
memberTim Deveaux21-Oct-08 6:38 
GeneralMissing column headers Pin
jsumm28-Mar-08 11:33
memberjsumm28-Mar-08 11:33 
GeneralRe: Missing column headers Pin
Tim Deveaux28-Mar-08 14:08
memberTim Deveaux28-Mar-08 14:08 

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

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

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