本帖最后由 twiker 于 2011-08-17 21:00:22 编辑

解决方案 »

  1.   

    你Debug下调试一下UpdatePopupMenu函数
      

  2.   

    就是到DataSource.size()=0那就返回了
      

  3.   

    // MFC Collection class search
    CJStruct * pCurrent;
    for (int nCol=-1;TotalCol>nCol;nCol++)
    { if (nStartAfter == -1) //search for entire combobox
    {
    POSITION pos = m_jcbList.GetHeadPosition();
    while (pos != NULL)
    {
    if (lpszString == (pCurrent = m_jcbList.GetNext(pos))->m_strKey[nCol+1])
    return CComboBox::SetCurSel(pCurrent->m_nKey);      
      
    }

    }
    else
    { //if you don't want to search the entire Combobox
    POSITION pos = m_jcbList.GetHeadPosition();
    while (pos != NULL)
    {

    if (nStartAfter == (pCurrent = m_jcbList.GetNext(pos))->m_nKey)
    {
    if (lpszString == pCurrent->m_strKey[nCol+1])
    return CComboBox::SetCurSel(pCurrent->m_nKey);
    break;
    }

    }
    } //END ELSE } //end for