vb怎么在text中重复打开记事本实现刷新功能

如题所述

第1个回答  2015-04-21
Dim n As Long, chazhao As String
Private Sub Command1_Click()'这段代码为查找
Dim s As String
s = Text1.Text
chazhao = InputBox("")
If chazhao = "" Then
MsgBox "空字符串不能查找"
Exit Sub
End If
n = InStr(s, chazhao)
If n > 0 Then
Text1.SelStart = n - 1
Text1.SelLength = Len(chazhao)
Text1.SetFocus
Else
MsgBox "不包含所查找的字符串"
End If
End Sub

Private Sub Command2_Click()'这段代码为查找下一个
Dim s As String, linshi As Long
If chazhao = "" Then
chazhao = InputBox("")
If chazhao = "" Then
MsgBox "空字符串不能查找"
Exit Sub
End If
End If
If n = 0 Then
s = Text1.Text
Else
s = Mid(Text1.Text, n + Len(chazhao), Len(Text1.Text) - n - Len(chazhao))
End If
linshi = n
n = InStr(s, chazhao)
If n > 0 Then
n = n + linshi
Text1.SelStart = n - 1
Text1.SelLength = Len(chazhao)
Text1.SetFocus
Else
If linshi <> 0 Then
MsgBox "没有相似的了"
End If
End If
End Sub
第2个回答  2015-04-21
利用timer控件定时读取就可以本回答被网友采纳
第3个回答  2015-04-21
Timer控件,定时refresh
相似回答
大家正在搜