你好,今天碰到一个问题,让我很苦恼
关于组合框控件的
void CMy000005Dlg::OnCloseupCombo1()
{
// TODO: Add your control notification handler code here
this->UpdateData();
AfxMessageBox(m_test);//m_test是赋给组合框的CString变量
}
当我选择它的一项时,通过AfxMessageBox(m_test)得到的是前一次选择的值,如何才能得到我当前选择的值?
感谢!
关于组合框控件的
void CMy000005Dlg::OnCloseupCombo1()
{
// TODO: Add your control notification handler code here
this->UpdateData();
AfxMessageBox(m_test);//m_test是赋给组合框的CString变量
}
当我选择它的一项时,通过AfxMessageBox(m_test)得到的是前一次选择的值,如何才能得到我当前选择的值?
感谢!
CComboBox* pCombo = (CComboBox*)GetDlgItem(IDC_COMBO1);
ASSERT(pCombo);
int nIndex = pCombo->GetCurSel();
if(CB_ERR != nIndex)
{
CString str;
pCombo->GetLBText(nIndex, str);
AfxMessageBox(str);
}