当您打开记事本并输入 10 行后,然后单击找到它,当我们选择单选按钮时会打开一个对话框。它在上方找到字符串。我希望 vb 6.0 中的代码执行相同的搜索过程
Private Sub btnfind_Click()
str = InputBox("Enter string to search", "Find")
pos = RichTextBox1.Find(str)
If pos <> -1 Then
RichTextBox1.SetFocus
Else
MsgBox "not found"
End If
btnfindnext.Enabled = True
btnprevious.Enabled = True
End Sub
Private Sub btnfindnext_Click()
pos = RichTextBox1.Find(str, pos + 1)
If pos <> -1 Then
RichTextBox1.SetFocus
Else
pos = RichTextBox1.Find(str, 0)
RichTextBox1.SetFocus
End If
End Sub