kampi
kampi

Reputation: 2484

How to retrieve data from a ListControl(ListView)?

I have a listcontrol with three columns. I want to read what text is in the third column. I need this, because i want color this column according to that what text is in it. Can anyone tell me, how to read the data?

Thanks in advance!

kampi

Upvotes: 1

Views: 1581

Answers (1)

Brian R. Bondy
Brian R. Bondy

Reputation: 347456

If your control's associated CListCtrl is called m_listCtrl simply use:

CString colText = m_listCtrl.GetItemText(item, subitem);

You associate that variable with the control itself via something like this:

void CMyDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    DDX_Control(pDX, IDC_LIST1, m_listCtrl);
}

Upvotes: 2

Related Questions