我想在dropDown这个控件后就得到所选的字符串和index怎么做。我绕了一个大弯才得到。

解决方案 »

  1.   

    使用CComboBox的成员函数:FindString
      

  2.   

    int nIndex = m_combo.GetCurSel();
    CString text;
    m_combo.GetLBText(nIndex, text);
      

  3.   

    这样不行的,没有当前CurSel,在DROPDOWN事件中写入执行时就会出错。
      

  4.   

    GetCurSel,GetDlgItemText两函数可以搞定,我的程序就是用这个实现的。
      

  5.   

    m_NComm->SetCulSel(0);
    int nIndex = m_combo.GetCurSel();
    CString text;
    m_combo.GetLBText(nIndex, text);
      

  6.   

    相应CBN_SELCHANGE
    void CAssembleFind::OnSelchangeZimu() 
    {
    int index=0;
        index=m_zimu.GetCurSel();
    CString str;
    str.Format("%d",index);
    AfxMessageBox(str);
    m_zimu.GetLBText(index,m_strZiMu);
    AfxMessageBox(m_strZiMu);      }
      

  7.   

    谢谢各位。此问题已解决。我用ANDY——LDU说的试了一下,可以。我的分数有限,请各位见谅。