问题:想做成跟百度的那个textbox差不多的功能.. 用text也好 或者combo也好~~
如:输入 a 就会自动显示 a相关的内容.. 在数据库里查询的
就是 这个自动显示下拉框 想不通...需要怎么做才好...求解...
a1
a2
a3
b1
b2
b3
PS:看过 大小的不同的软件 也在医院见过类似功能,输入代码就会自动跳出药名。。
如:输入 a 就会自动显示 a相关的内容.. 在数据库里查询的
就是 这个自动显示下拉框 想不通...需要怎么做才好...求解...
a1
a2
a3
b1
b2
b3
PS:看过 大小的不同的软件 也在医院见过类似功能,输入代码就会自动跳出药名。。
Private Const KEY_A = 65
Private Const KEY_Z = 90
Private Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Long) As Long
Private Sub Combo1_KeyUp(KeyCode As Integer, Shift As Integer)
Dim sComboText As String
Dim iLoop As Integer
Dim sTempString As String
Dim lReturn As Long
If KeyCode >= KEY_A And KeyCode <= KEY_Z Then
'only look at letters A-Z
sTempString = Combo1.Text
If Len(sTempString) = 1 Then sComboText = sTempString
lReturn = SendMessage(Combo1.hwnd, WM_SETREDRAW, False, 0&)
For iLoop = 0 To (Combo1.ListCount - 1)
If UCase((sTempString & Mid$(Combo1.List(iLoop), _
Len(sTempString) + 1))) = UCase(Combo1.List(iLoop)) Then
Combo1.ListIndex = iLoop
Combo1.Text = Combo1.List(iLoop)
Combo1.SelStart = Len(sTempString)
Combo1.SelLength = Len(Combo1.Text) - (Len(sTempString))
sComboText = sComboText & Mid$(sTempString, Len(sComboText) + 1)
Exit For
Else
If InStr(UCase(sTempString), UCase(sComboText)) Then
sComboText = sComboText & Mid$(sTempString, Len(sComboText) _
+ 1)
Combo1.Text = sComboText
Combo1.SelStart = Len(Combo1.Text)
Else
sComboText = sTempString
End If
End If
Next iLoop
lReturn = SendMessage(Combo1.hwnd, _
WM_SETREDRAW, True, 0&)
End If
End Sub Sub Form_load()
Combo1.AddItem "Alpha"
Combo1.AddItem "Beta"
Combo1.AddItem "Charlie"
Combo1.AddItem "Delta"
Combo1.AddItem "Dingo"
End Sub
不过 这样的话 该怎么做呢?请教。。
我只是考虑到 自动显示出数据了 会不会看起来直观点而已~~~
于是我就用了这个~~
SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, 1, 0
请泰山给点意见呀~~~指点 指点~~~
使用了combo 采用了 asftrhgjhkjlkttttttt 给与的办法...
泰山的办法也蛮好的,不过不适合有中文输入...但是还是谢谢你的帮助..
自动下拉框有一个bug..就是会残影..
我用timer控件 解决了..谢谢各位的指点 再次结贴...