report类型的 列表控件如何获取某行某列里的字符串内容????

解决方案 »

  1.   

    使用CListCtrl的GetItemText函数。
      

  2.   

    m_recordpath=m_listmsg.GetItemText(nItem,6);
      

  3.   

    int GetItemText( int nItem, int nSubItem, LPTSTR lpszText, int nLen ) const;CString GetItemText( int nItem, int nSubItem ) const;Return ValueThe version returning int returns the length of the retrieved string.The version returning a CString returns the item text.ParametersnItemThe index of the item whose text is to be retrieved.nSubItemSpecifies the subitem whose text is to be retrieved.lpszTextPointer to a string that is to receive the item text.nLenLength of the buffer pointed to by lpszText.ResRetrieves the text of a list view item or subitem. If nSubItem is zero, this function retrieves the item label; if nSubItem is nonzero, it retrieves the text of the subitem. For more information on the subitem argument, see the discussion of theLVITEM structure in the Platform SDK.
      

  4.   

    CString item=m_lista.GetItemText(row,col);//这样可以获取你想要的单元格,col为第几列 
      

  5.   

    CString emun_id2 = "";
    //char str[256]={0};
    CString str = "";

    CListCtrl  *pListCtrl = (CListCtrl*)CWnd::FromHandle(hchildWnd_REC); int nIndex = pListCtrl->GetItemCount();
    //int nlen = pListCtrl->GetHeaderCtrl()->GetItemCount();
    str_id.Format("%d", nIndex);
    //pList->GetText(nIndex1,str_name);

    //MessageBox(str_id);

    for(int i=0;i<nIndex;i++)
    {
        str = pListCtrl->GetItemText(i,0);

    emun_id2  = emun_id2 + str_id  + "  " + str +"\n";
    }