用vb编一个TXT搜索功能???

来源:百度知道 编辑:UC知道 时间:2024/06/17 12:31:33
比如搜索一个"我是??"两个问号是任意的两个字符,然后自动翻到该行,并自动选中该四个字符

Dim l as Integer '这句摆到通用区域

Private Sub Command1_Click()
On Error Resume Next
If InStr(l + 1, Text1.Text, "我是??") <> 0 Then
l = InStr(l + 1, Text1.Text, "我是??")
Text1.SelStart = l - 1
Text1.SelLength = Len("我是??")
Text1.SetFocus
Else
l = 0
l = InStr(l + 1, Text1.Text, "我是??")
Text1.SelStart = l - 1
Text1.SelLength = Len("我是??")
Text1.SetFocus
End If
End Sub

没分啊????
那就告诉你用RichTextBox控件吧,有现成的Find和SelText功能,具体怎么做看你咯.

你是零分

0分?

0分...