Here is a very simple request, or so I thought.
Ho do I code a Find and Replace function into my VB.Net program?
I have a very basic find function
Public Sub Find()
Dim lngPos As Long
m_strSearch = InputBox("Enter the text to find.", "Find Text")
If m_strSearch = "" Then Exit Sub
lngPos = InStr(1, txtEdit.Text, m_strSearch, vbTextCompare)
If lngPos > 0 Then
txtEdit.SelectionStart = lngPos - 1
txtEdit.SelectionLength = Len(m_strSearch)
Else
m_strSearch = ""
MsgBox("Search text was not found.", vbExclamation, "No Found Text")
End If
End Sub
But I have no clue as to a replace function.
Please help.
Ho do I code a Find and Replace function into my VB.Net program?
I have a very basic find function
Public Sub Find()
Dim lngPos As Long
m_strSearch = InputBox("Enter the text to find.", "Find Text")
If m_strSearch = "" Then Exit Sub
lngPos = InStr(1, txtEdit.Text, m_strSearch, vbTextCompare)
If lngPos > 0 Then
txtEdit.SelectionStart = lngPos - 1
txtEdit.SelectionLength = Len(m_strSearch)
Else
m_strSearch = ""
MsgBox("Search text was not found.", vbExclamation, "No Found Text")
End If
End Sub
But I have no clue as to a replace function.
Please help.