解决方案 »

  1.   

    添加不就可以了?
    AddString()
      

  2.   

    CComboBox::SetCurSel
    int SetCurSel( int nSelect );Return ValueThe zero-based index of the item selected if the message is successful. The return value is CB_ERR if nSelect is greater than the number of items in the list or if nSelect is set to –1, which clears the selection.ParametersnSelectSpecifies the zero-based index of the string to select. If –1, any current selection in the list box is removed and the edit control is cleared.ResSelects a string in the list box of a combo box. If necessary, the list box scrolls the string into view (if the list box is visible). The text in the edit control of the combo box is changed to reflect the new selection. Any previous selection in the list box is removed.Example// The pointer to my combo box.
    extern CComboBox* pmyComboBox;// Select the last item in the combo box.
    int nCount = pmyComboBox->GetCount();
    if (nCount > 0)
       pmyComboBox->SetCurSel(nCount-1);
      

  3.   

    或者用SelectStringCComboBox::SelectString
    int SelectString( int nStartAfter, LPCTSTR lpszString );Return ValueThe zero-based index of the selected item if the string was found. If the search was unsuccessful, the return value is CB_ERR and the current selection is not changed.ParametersnStartAfterContains the zero-based index of the item before the first item to be searched. When the search reaches the bottom of the list box, it continues from the top of the list box back to the item specified by nStartAfter. If –1, the entire list box is searched from the beginning.lpszStringPoints to the null-terminated string that contains the prefix to search for. The search is case independent, so this string can contain any combination of uppercase and lowercase letters.ResSearches for a string in the list box of a combo box, and if the string is found, selects the string in the list box and copies it to the edit control. A string is selected only if its initial characters (from the starting point) match the characters in the prefix string. Note that the SelectString and FindString member functions both find a string, but the SelectString member function also selects the string.Example// The pointer to my combo box.
    extern CComboBox* pmyComboBox;
    // The string to match.
    extern LPCTSTR lpszmyString;// Select the item that begins with the specified string.
    int nIndex = pmyComboBox->SelectString(0, lpszmyString);
    ASSERT(nIndex != LB_ERR);
      

  4.   

    多谢多谢 我已经搞好了 谢谢 以后一定多看MSDN