首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

关于Sendmessage的有关问题

2012-01-22 
关于Sendmessage的问题大家好:先看一段代码:DimiStartAsIntegerDimsStringAsStringStaticiLeftOffAsIntege

关于Sendmessage的问题
大家好:先看一段代码:
    Dim   iStart   As   Integer
    Dim   sString     As   String
    Static   iLeftOff   As   Integer
    On   Error   GoTo   error_des
    If   KeyAscii   =   13   Then
          iStart   =   1
          iStart   =   Cmb_ACNo.SelStart
          If   iLeftOff   <>   0   Then   Cmb_ACNo.SelStart   =   iLeftOff:   iStart=iLeftOff
                sString   =   CStr(Left(Cmb_ACNo.text,   iStart))
                Cmb_ACNo.ListIndex   =   SendMessage(Cmb_ACNo.hwnd,   &H14C,   -                   1,ByVal   CStr(Left(Cmb_ACNo.text,   iStart)))
                If   Cmb_ACNo.ListIndex   =   -1   Then   iLeftOff   =   Len(sString):               Cmb_ACNo.text   =   sString
                If   Cmb_ACNo.text   <>   " "   Then   SendMessage   Cmb_ACNo.hwnd,   &H14F,   True,   0
                Cmb_ACNo.SelStart   =   iStart
                Cmb_ACNo.SelLength   =   0
                iLeftOff   =   0
        End   If
注:   Cmb_ACNo是控件comboBox。
我的目的是利用SendMessage来实现comboBox的自动查询,可是每次找到列表框中的数据后,按回车后结果文本框中值是空。我希望是按回车后会把所选的值填充到文本框中。
请问该怎样做?请大家帮忙,谢谢!


[解决办法]
sString有值吗?
[解决办法]
For i = 1 To Combo1.ListCount - 1
str = Combo1.List(i)
Debug.Print str
Combo1.Text = str
Next i

热点排行
Bad Request.