CListBox multicolumn

Posted on 2004-11-22
Last Modified: 2013-11-20
Hi can some one please post an example how to create and use multicolumn listbox...

CListBox * listBox = new CListBox();
listBox->Create(LBS_MULTICOLUMN | LBS_HASSTRINGS | WS_VISIBLE | WS_BORDER, CRect(20, 20, 170, 170), this, 65536);

this is my example, but it has only one column.. how to add a new column and data into it?

Question by:GiedriusS
    1 Comment
    LVL 55

    Accepted Solution

    You can't take full control about multiple columns in a listbox, it is virtually a single column that is wrapped, so you can't ensure to put many columns for a same row aligned. Better you can use a CListCtrl instead, in "report" mode. Look at:

    There are some examples at, but a simple on could be:

    CListCtrl *listCtrl = new CListCtrl();
    listCtrl->Create(WS_VISIBLE|WS_BORDER|LVS_REPORT, CRect(20, 20, 170, 170), this, 65536);
    listCtrl->InsertColumn(0, "1st", 35);
    listCtrl->InsertColumn(1, "2nd", 35);
    listCtrl->InsertColumn(2, "3rd", 35);

    listCtrl->InsertItem(0, "");

    Some related articles:


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
    Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    745 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

    16 Experts available now in Live!

    Get 1:1 Help Now