I have found a way to search forwards (or down) in a textarea but I’m having trouble searching backwards (or up).
Here is what I have for forwards (or down):
[code]Var searchText As String = tfFindUp.Value
Var charPos As Integer
Var startPosition as Integer
if taMain.SelectionLength > 0 then
startPosition = taMain.SelectionStart + 1
startPosition = 0
charPos = taMain.Value.IndexOf(startPosition, searchText)
If charPos >= 0 Then
taMain.SelectionStart = charPos
taMain.SelectionLength = searchText.Length
Can anyone help me figure out how to search backwards?
By default Indexof only works moving forward. I was thinking of looping one character at a time backwards (-1) until it found the next. I also thought of reversing the text area in memory, but that was way too messy.