7,763
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Dim WithEvents findDialog As findDialog
Private Sub Command1_Click()
List1.AddItem Text1
End Sub
Private Sub Command2_Click()
If findDialog Is Nothing Then Set findDialog = New findDialog
findDialog.Show , Me
End Sub
Private Sub findDialog_OnFind(ByVal s As String)
Dim curr As Integer
Dim i As Integer
curr = List1.ListIndex
For i = curr + 1 To List1.ListCount - 1
If InStr(1, List1.List(i), s) > 0 Then
List1.ListIndex = i
Exit Sub
End If
Next
For i = 0 To curr
If InStr(1, List1.List(i), s) > 0 Then
List1.ListIndex = i
Exit Sub
End If
Next
MsgBox "没找到"
End Sub
Option Explicit
Public Event OnFind(ByVal s As String)
Private Sub Command1_Click()
RaiseEvent OnFind(Text1.Text)
Me.SetFocus
End Sub