-1
當你打開記事本並輸入10行後&然後點擊找到它打開對話框 當我們選擇單選按鈕時。它在上方找到字符串。我想在VB 6.0代碼做同樣的搜索過程 我曾嘗試這個代碼,但它正向查找字符串在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
什麼樣的代碼你試過嗎? – BenR