Click here to Skip to main content
13,344,765 members (61,082 online)
Click here to Skip to main content
Add your own
alternative version


38 bookmarked
Posted 12 Dec 1999

A multi-check ListBox

, 12 Dec 1999
Rate this:
Please Sign up or sign in to vote.
Extends the CCheckListBox class to have multiple check box columns
  • Download demo project - 15 Kb
  • Download source files - 4 Kb
  • Sample Image - multichecklistbox.jpg

    <!-- Article Starts -->

    I had a desire/requirement on a recent project to have a CCheckListbox class that allowed for more than one checkbox in front of the string. The 3-state style set by the CCheckListbox simply didn't do what I wanted or needed. I had a list of people who could fall into 2 different categories at the same time. The 3-state style told me that this person fell into one category, but I had to just know WHICH one.

    So, I decided to write a class that extended the capabilities of the CCheckListbox. What I came up with was the CMultiCheckListBox class. What it does is add another checkbox in front of the original checkbox in the CCheckListbox implementation.

    To use the class, follow these steps:

    • Add a member variable to the desired class (CDialog, CFormView, etc.)
      CMultiCheckListBox m_List;
    • Subclass the list box variable just created.
      void CCharityReportDlg::DoDataExchange(CDataExchange* pDX)
          DDX_Control(pDX, IDC_LIST1, m_List);
    • To set the first checkbox for listbox item nIndex, call SetCheck(nIndex, nCheck)
    • To set the second checkbox, call SetMultiCheck(nIndex, nCheck)
    • To retrieve the checkbox state of the first checkbox, call GetCheck(nIndex)
    • To retrieve the checkbox state of the second checkbox, call GetMultiCheck(nIndex)


    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    About the Author

    Harry J. Devine
    Web Developer
    United States United States
    No Biography provided

    You may also be interested in...

    Comments and Discussions

    General[Message Deleted] Pin
    JAS GIRI17-Feb-09 2:54
    memberJAS GIRI17-Feb-09 2:54 
    GeneralRe: check box small example Pin
    Christian Graus18-Feb-09 13:44
    mvpChristian Graus18-Feb-09 13:44 
    QuestionCan we have items with NO checkboxes? Pin
    Gary Chapman23-May-06 6:47
    memberGary Chapman23-May-06 6:47 
    AnswerRe: Can we have items with NO checkboxes? Pin
    Harry J. Devine23-May-06 9:38
    memberHarry J. Devine23-May-06 9:38 
    GeneralDrawFrameControl Pin
    Javi_26-Apr-05 10:01
    memberJavi_26-Apr-05 10:01 
    GeneralSample code Pin
    Anonymous7-Feb-05 5:09
    sussAnonymous7-Feb-05 5:09 
    I am unable to download the samples. Can you direct me to an available link that I can do this?
    GeneralRe: Sample code Pin
    Harry J. Devine7-Feb-05 11:39
    memberHarry J. Devine7-Feb-05 11:39 
    Generalmore than 2 checkboxes Pin
    robert guy24-Oct-00 9:50
    sussrobert guy24-Oct-00 9:50 
    General3D check boxes Pin
    Jeremy Asbill3-Oct-00 11:12
    sussJeremy Asbill3-Oct-00 11:12 
    GeneralRe: 3D check boxes Pin
    Tom Hughes20-Dec-00 0:12
    memberTom Hughes20-Dec-00 0:12 
    GeneralAdd multiple columns in ListBox Pin
    Santhosh Joseph20-Sep-00 0:45
    sussSanthosh Joseph20-Sep-00 0:45 
    GeneralRe: Add multiple columns in ListBox Pin
    Harry Devine20-Sep-00 10:29
    sussHarry Devine20-Sep-00 10:29 

    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 | Terms of Use | Mobile
    Web04 | 2.8.180111.1 | Last Updated 13 Dec 1999
    Article Copyright 1999 by Harry J. Devine
    Everything else Copyright © CodeProject, 1999-2018
    Layout: fixed | fluid