10 个解决方案
#1
什么意思?
#2
不明你的意思
#3
用API函数可以搞定。
#4
需要自己编程序查询控制,没有方便的方法
#5
proking(小卢) :
请问是那个API啊?
请问是那个API啊?
#6
有写好的控件,我下载了,觉得不打好用,不知合不合你用。
要的话,MAIL给你。
要的话,MAIL给你。
#7
谢谢了,anglerchan(渔人丸) ,但是我希望能有源码!
#8
是有源码啊,不是完整的控件,是不用修改就能运行的源程序,在鬼佬的网站上DOWN的。
可能对你有用。
可能对你有用。
#9
在一个窗体上放一个 combo 控件,就可以运行了!
Option Explicit
Private Const CB_FINDSTRING = &H14C
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
Private Sub Combo1_Change()
On Error Resume Next
Dim Search As String, listIndex As Long
Search = Combo1.Text
If Len(Search) > 0 Then
listIndex = SendMessage(Combo1.hwnd, CB_FINDSTRING, -1, ByVal Search)
Combo1.listIndex = listIndex
Else
Combo1.listIndex = 0
End If
Combo1.SelStart = Len(Search)
Combo1.SelLength = Len(Combo1.Text)
End Sub
Private Sub Form_Load()
Dim i As Integer
With Combo1
For i = 0 To 100
.AddItem i & "abc"
Next
End With
End Sub
Option Explicit
Private Const CB_FINDSTRING = &H14C
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
Private Sub Combo1_Change()
On Error Resume Next
Dim Search As String, listIndex As Long
Search = Combo1.Text
If Len(Search) > 0 Then
listIndex = SendMessage(Combo1.hwnd, CB_FINDSTRING, -1, ByVal Search)
Combo1.listIndex = listIndex
Else
Combo1.listIndex = 0
End If
Combo1.SelStart = Len(Search)
Combo1.SelLength = Len(Combo1.Text)
End Sub
Private Sub Form_Load()
Dim i As Integer
With Combo1
For i = 0 To 100
.AddItem i & "abc"
Next
End With
End Sub
#10
sc是要搜索的文本,以下代码是增量查询
For i = 0 To Combo1.ListCount - 1
If sc = Left(Combo1.List(i), Len(sc)) Then
Combo1.ListIndex = i
Exit For
End If
Next i
For i = 0 To Combo1.ListCount - 1
If sc = Left(Combo1.List(i), Len(sc)) Then
Combo1.ListIndex = i
Exit For
End If
Next i
#1
什么意思?
#2
不明你的意思
#3
用API函数可以搞定。
#4
需要自己编程序查询控制,没有方便的方法
#5
proking(小卢) :
请问是那个API啊?
请问是那个API啊?
#6
有写好的控件,我下载了,觉得不打好用,不知合不合你用。
要的话,MAIL给你。
要的话,MAIL给你。
#7
谢谢了,anglerchan(渔人丸) ,但是我希望能有源码!
#8
是有源码啊,不是完整的控件,是不用修改就能运行的源程序,在鬼佬的网站上DOWN的。
可能对你有用。
可能对你有用。
#9
在一个窗体上放一个 combo 控件,就可以运行了!
Option Explicit
Private Const CB_FINDSTRING = &H14C
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
Private Sub Combo1_Change()
On Error Resume Next
Dim Search As String, listIndex As Long
Search = Combo1.Text
If Len(Search) > 0 Then
listIndex = SendMessage(Combo1.hwnd, CB_FINDSTRING, -1, ByVal Search)
Combo1.listIndex = listIndex
Else
Combo1.listIndex = 0
End If
Combo1.SelStart = Len(Search)
Combo1.SelLength = Len(Combo1.Text)
End Sub
Private Sub Form_Load()
Dim i As Integer
With Combo1
For i = 0 To 100
.AddItem i & "abc"
Next
End With
End Sub
Option Explicit
Private Const CB_FINDSTRING = &H14C
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
Private Sub Combo1_Change()
On Error Resume Next
Dim Search As String, listIndex As Long
Search = Combo1.Text
If Len(Search) > 0 Then
listIndex = SendMessage(Combo1.hwnd, CB_FINDSTRING, -1, ByVal Search)
Combo1.listIndex = listIndex
Else
Combo1.listIndex = 0
End If
Combo1.SelStart = Len(Search)
Combo1.SelLength = Len(Combo1.Text)
End Sub
Private Sub Form_Load()
Dim i As Integer
With Combo1
For i = 0 To 100
.AddItem i & "abc"
Next
End With
End Sub
#10
sc是要搜索的文本,以下代码是增量查询
For i = 0 To Combo1.ListCount - 1
If sc = Left(Combo1.List(i), Len(sc)) Then
Combo1.ListIndex = i
Exit For
End If
Next i
For i = 0 To Combo1.ListCount - 1
If sc = Left(Combo1.List(i), Len(sc)) Then
Combo1.ListIndex = i
Exit For
End If
Next i