一个棘手的问题。请高手指点
现在有一个LIST控件,里面有N个字符串,现在又有很大的一个数组,存有大量字符串, 如何快速判断这些字符串是否是这个LIST控件中有的,如果这个LIST字符串中没有这个字符串,就把数组中这个字符串给剔除掉。有没有比较好的方法?不要遍历,因为那样太慢。。呵呵
Option Explicit Private Const LB_FINDSTRING = &H18F Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Sub Form_Load() Dim i& For i = Asc("A") To Asc("Z") List1.AddItem Chr$(i) Next For i = 1 To 500 List1.AddItem i Next Text1.Text = vbNullString End Sub Private Sub Text1_Change() Dim s$, i& s$ = Text1.Text i& = SendMessage(List1.hWnd, LB_FINDSTRING, -1, ByVal s) Debug.Print i&, s$ If i > 0 Then List1.ListIndex = i& End If End Sub