Dim seach As String, where As Integer, k As Integer
Private Function find(p As Integer) As Integer
Dim n As Integer
k = Len(seach)
For i% = p To Len(Text1.Text)
If search = Mid(Text1.Text, i%, k) Then Exit For
Next i%
If i% > Len(Text1.Text) Then find = 0 Else find = i%
End Function
Private Sub cmd1_Click() '查找
Text1.SetFocus
seach = InputBox("输入需要查找的字符串", "查找")
where = find(1)
If where <> 0 Then
Text1.SelStart = where - 1
Text1.SelLength = k
Else
MsgBox "没有找到!"
End If
End Sub
Private Sub cmd2_Click() '下一个
Text1.SetFocus
If seach <> "" Then
where = find(where + 1)
If where <> 0 Then
Text1.SelStart = where - 1
Text1.SelLength = k
Else
If where = 0 Then MsgBox "没有找到"
End If
End If
End Sub
Private Sub cmd3_Click() '剪切
Clipboard.Clear
Clipboard.SetText Text1.SelText
Text1.SelText = ""
End Sub
Private Sub cmd4_Click() '复制
Clipboard.Clear
Clipboard.SetText Text1.SelText
End Sub
Private Sub cmd5_Click() '粘贴
Text1.SelText = Clipboard.GetText
End Sub
Private Sub cmd6_Click() '删除
Text1.SelText = ""
End Sub
Private Sub cmd7_Click() '清除
Text1.Text = ""
End Sub
Private Sub Cmd8_Click()
End
End Sub
大家可以看看是什么原因吗,“查找”与“下一个”功能好像无法调试通过。