本文演示了读取CListCtrl的方法:

界面:

CListCtrl数据读取

读取数据按钮的点击事件代码为:

void CCheckListCtrlDemoDlg::OnButtonRead() 
{
	UpdateData();
	CCheckListCtrl *pListCtrl = (CCheckListCtrl*)GetDlgItem(IDC_LIST1);
	if(m_nRowIndex >= 1 && m_nRowIndex <= (UINT)pListCtrl->GetItemCount())
	{
		CCheckListCtrl *pListCtrl = (CCheckListCtrl*)GetDlgItem(IDC_LIST1);
		CString txt, temp;
		temp = pListCtrl->GetItemText(m_nRowIndex-1, 0);		// 读取指定行,第0列
		txt = temp + ", ";
		temp = pListCtrl->GetItemText(m_nRowIndex-1, 1);		// 读取指定行,第1列
		txt += temp + ", ";
		temp = pListCtrl->GetItemText(m_nRowIndex-1, 2);		// 读取指定行,第2列
		txt += temp;
		MessageBox(txt);
	}
}

另外,CListCtrl的数据插入参见:http://blog.csdn.net/JoeBlackzqq/archive/2010/11/03/5983558.aspx

相关文章:

  • 2021-04-08
  • 2021-11-07
  • 2022-02-07
  • 2021-06-29
  • 2021-05-19
  • 2022-02-10
  • 2021-09-11
  • 2021-06-20
猜你喜欢
  • 2022-12-23
  • 2021-06-28
  • 2021-06-24
  • 2022-12-23
  • 2021-11-20
  • 2022-01-01
相关资源
相似解决方案