在Change事件里用当前文本框或下拉框的文本作为条件来检索就行了.

解决方案 »

  1.   

    Private Declare Function SendMessage Lib "USER32" Alias "SendMessageA"(ByVal hWnd As Long,ByVal Msg as Long,byval wParam as long,byval lParam as long) as longconst CB_FINDSTRING=&H14CPrivate sub combo1_Change()
    dim iStart as Integer
    dim sString as string
    Static iLeftOff as integer
        istart=1
        istart=combo1.selstart
        if ileftoff<>0 then
            combo1.selstart=ileftoff
            istart=ileftoff
        end if
        sstring=cstr(left(combo1.text,istart))
        combo1.listindex=sendmessage(combo1.hwnd,cb_findstring,-1,sstring)    if combo1.listindex=-1 then
            ileftoff=len(sstring)
            combo1.text=sstring
        end if    combo1.selstart=istart
        ileftoff=0
    end sub