如何在textbox里实现查找冠词("a","an","the")的功能?并且可以实现查找下一个,在找到后以高亮度显示

解决方案 »

  1.   

    Public po As Long
    Function find(key As String, Text1 As TextBox)
    s = Text1.Text
    t = key
    Indexs = InStr(po, s, t)
         If Indexs > 0 Then
         With Text1
         .SelStart = Indexs - 1
         .SelLength = Len(t)
         .SetFocus
         End With
         po = Indexs + 1
         Else
         MsgBox "没有找到你寻求的串"
         po = 1
         End If
    End FunctionPrivate Sub Command1_Click()
    t = find("an", Text1)
    End SubPrivate Sub Form_Load()
    po = 1
    End SubPrivate Sub Text1_Change()
    po = 1
    End Sub