Name: Anonymous 2009-05-18 0:49
I need some help doing this Visual Basic project.... I need to incorporate into my Notepad-like program a find/replace function. I already have the Replace all working fine, but I can't figure out how to make my find button a find + find next (ex. it finds one occurrence, you press it again and the next occurrence is highlighted) Here is what i gots so far.
a = txtSearchWord.Text
b = InStr(TextEditor.txtMain.Text, txtSearchWord.Text)
If b Then
TextEditor.txtMain.Focus()
TextEditor.txtMain.SelectionStart = b - 1
TextEditor.txtMain.SelectionLength = Len(a)
Else
MsgBox("Text not found.")
End If
a = txtSearchWord.Text
b = InStr(TextEditor.txtMain.Text, txtSearchWord.Text)
If b Then
TextEditor.txtMain.Focus()
TextEditor.txtMain.SelectionStart = b - 1
TextEditor.txtMain.SelectionLength = Len(a)
Else
MsgBox("Text not found.")
End If