Thank you have time to see this post
I have a function,
I hope it can achieve to read each line of the specified List Control column values​​,
I refer to the MSDN, he suggest to use this function: CString GetItemText (int nItem, int subItem);
But after I spent no response, or lack of value, how is this going?
Source code is as follows:
notes:md_dataLC is List Control's variable
where is the problem?
I have a function,
I hope it can achieve to read each line of the specified List Control column values​​,
I refer to the MSDN, he suggest to use this function: CString GetItemText (int nItem, int subItem);
But after I spent no response, or lack of value, how is this going?
Source code is as follows:
notes:md_dataLC is List Control's variable
Code:
void CICDlg::OnBnClickedButtonChange()
{
//得到被选ä¸é¡¹ç´¢å¼•
CString ALL="",MID="",VALUE[4];
int Where = md_dataLC.GetSelectionMark();
for(int i = 0;i<4;i++)
{
VALUE[i] = md_dataLC.GetItemText(Where,i); [COLOR="Blue"]//â†this doesn't work,what's wrong?[/COLOR]
}
ALL = Value[0]+"$"+Value[1]+"$"+Value[2]+"$"+Value[3];
MessageBox(ALL,"æ¥è‡ªICDlg");
//准备交æ¢æ•°æ®
CFile ff;
char all[9999];
ff.Open("C:\\bufferofCA.txt",CFile::modeReadWrite);
//写入数æ®ï¼Œä»¥ä¾¿äº¤æ¢
ff.Write(ALL,ALL.GetLength());
ff.Close();
//显示修改对è¯æ¡†
AddNewItemDlg dlg;
dlg.DoModal();
//读å–æ•°æ®
CFile f;
f.Open("C:\\bufferofCA.txt",CFile::modeReadWrite);
f.Read(all,f.GetLength());
for(int i= 0;i<f.GetLength();i++)
{
ALL+= all[i];
}
Value[0] = ALL.Left(ALL.Find("$"));
MID = ALL.Right(ALL.GetLength()-ALL.Find("$")-1);
ALL = MID;
Value[1] = ALL.Left(ALL.Find("$"));
MID = ALL.Right(ALL.GetLength()-ALL.Find("$")-1);
ALL = MID;
Value[2] = ALL.Left(ALL.Find("$"));
MID = ALL.Right(ALL.GetLength()-ALL.Find("$")-1);
ALL = MID;
Value[3] = ALL;
//æ’入数æ®
for(int i = 0;i<4;i++)
{
md_dataLC.SetItemText(Where,i,Value[i]);
}
//æ›´æ–°æ•°æ®æ•°
CString buffer;
int nHeadNum = md_dataLC.GetItemCount();
buffer.Format("å…± %d æ¡æ•°æ®",nHeadNum);
GetDlgItem(MAINDIALOG_STATIC_DOWNTIP)->SetWindowText(buffer);
f.Close();
}
where is the problem?