dilog里有个listbox控件
用
this->SendShow.AddString("0");
this->SendShow.AddString("1");
this->SendShow.AddString("2");
this->SendShow.AddString("5");
this->SendShow.AddString("100");
this->SendShow.AddString("230");
设置了几项.现在需要删除其中某项
这个listbox设置为只能单选,
用this->SendShow.SetCurSel(0);获得选择的焦点,但是问题是我如何取得选中项的值,比如我要删除如上的"100"这个字符串这项,用int nCurSel = this->ID_list.GetCurSel();刻获得nCurSel = 4;请问如何利用这个nCurSel或者其他方式取得"100"这个数字???程序里可以保证这里取得的全部是数字,没有字符之类的
用
this->SendShow.AddString("0");
this->SendShow.AddString("1");
this->SendShow.AddString("2");
this->SendShow.AddString("5");
this->SendShow.AddString("100");
this->SendShow.AddString("230");
设置了几项.现在需要删除其中某项
这个listbox设置为只能单选,
用this->SendShow.SetCurSel(0);获得选择的焦点,但是问题是我如何取得选中项的值,比如我要删除如上的"100"这个字符串这项,用int nCurSel = this->ID_list.GetCurSel();刻获得nCurSel = 4;请问如何利用这个nCurSel或者其他方式取得"100"这个数字???程序里可以保证这里取得的全部是数字,没有字符之类的
GetLBText(nCurSel, strMsg);
strMsg 就是 “100”
你AddString插入A什么,读出来就是什么
while (pos)
{
int iItm = m_list.GetNextSelectedItem(pos);
CString str = m_list.GetItemText(iItm,0);
str = m_list.GetItemText(iItm,1);
..................
}
int nCurSel = ID_list.GetCurSel();
ID_list.GetText(nCurSel, strText); //获取选中项目的内容。
int nValue = _ttoi(strText); //将字符串转换为数值。
void GetText( int nIndex, CString& rString ) const;