Question: I'm working on a program, which should list all files and it's size(for now...). I created a simple application, which should write the data to a listbox. I'm trying to write the data in two columns(the first should be the name, and next to it, in an other column, it's size), but i can't figure out, how should i do this.
Can someone help me?

Thanks in advance!

kampi

Update:

I try to use ListControl., but unfortunately i can't. I can succesfully compile my App, but i can only see, the empty rectangle. Does someone know what i am doing wrong?

```
BOOL CGetFileListDlg::OnInitDialog()
{  
CDialog::OnInitDialog();

// Set the icon for this dialog.  The framework does this automatically
//  when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE);         // Set big icon
SetIcon(m_hIcon, FALSE);        // Set small icon

// TODO: Add extra initialization here

LVITEM lvItem;
LVCOLUMN lvColumn;
int nCol;

lvColumn.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvColumn.fmt = LVCFMT_CENTER;
lvColumn.cx = 10;
lvColumn.pszText = _T("Filename");
ListView_InsertColumn( m_List, 0, &lvColumn ); 
ListView_SetItemText( m_List, 0, 0, _T("TEST") );

return TRUE;  // return TRUE  unless you set the focus to a control    
}

```

Answer: 
The list box control does support multiple columns, but it only supports a single series of entries; the multiple column support just makes the items continue onto the next columns so that vertical scrolling is not necessary.

As Kornel has suggested, a [list view control](http://msdn.microsoft.com/en-us/library/bb774737%28VS.85%29.aspx) may be more appropriate. After creating a list view control, use [ListView\_InsertColumn](https://msdn.microsoft.com/en-us/library/windows/desktop/bb775032(v=vs.85).aspx) to create the columns. Then use [ListView\_SetItemText](http://msdn.microsoft.com/en-us/library/aa453373.aspx) to insert items.

EDIT:
My apoligies; you should use [ListView\_InsertItem](https://msdn.microsoft.com/en-us/library/windows/desktop/bb775038(v=vs.85).aspx) to insert an item (a row) and then use [ListView\_SetItemText](https://msdn.microsoft.com/en-us/library/windows/desktop/bb775105(v=vs.85).aspx) to alter the subitems (columns). If the list view is still just a blank box without any headings, have you initialised common controls? This can be done using [InitCommonControlsEx](http://msdn.microsoft.com/en-us/library/bb775697%28VS.85%29.aspx), specifying the `ICC_LISTVIEW_CLASSES` constant. This should be done before creating the control.

See [Microsoft's documentation on list view controls](http://msdn.microsoft.com/en-us/library/bb774736(VS.85).aspx#Creating_ListView_Controls).
Maybe to use DataGridView with object as data source.