Can I add multiple columns in MFC CListBox?

Codename_DJ picture Codename_DJ · May 29, 2013 · Viewed 12.2k times · Source

I have a dialog with a CListBox .I have to add 3 Columns in this list box.
Is there any way to have several different columns in CListBox ?
Or Can CListCtrl help in this regard?

Answer

Nayana Adassuriya picture Nayana Adassuriya · May 29, 2013
  • Listbox has list of items in 1 column, a list-control can have zero or more columns.
  • Natively, listbox does not have icon attached to it, list control has.
  • List control has "header control" on top of it, which can be used to arrange and/or sort the items in columns.
  • List Control (also know as report control) can have 4 or more view types (depending on OS) - icon, small icon, details/report, list and thumbnail.

The windows explorer file view (right side) is list control, fonts in Fonts dialog box is listbox.

Source : http://forums.codeguru.com/showthread.php?358739-CListBox-and-CListCtrl.

use CListCtrl::InsertColumn to add new column.