vb 怎样寻找TEXT1.TEXT里面的内容(就是记事本的查找功能如何实现?)

给出代码 是用在按钮 Click上的

Private Sub command1_click()

Dim sz As String
sz = InputBox("输入要查找的字符串")
For i = 1 To Len(Text1)
If Mid(Text1, i, Len(sz)) = sz Then
Print sz
Text1.SelStart = i
Text1.SelLength = Len(sz)
Exit For
End If
Next i

End Sub
温馨提示:答案为网友推荐,仅供参考
第1个回答  2009-05-21
p=1
while instr(p,text1.text,"要查找的字符串")
p=instr(p,text1.text,"要查找的字符串")
c=c+1
wend
print "要查找的字符串出现的次数为";C
相似回答
大家正在搜