Hi,
Is there any way to search for string backward ? I have a Richtextbox that contain a text and the user search for staring, how can i search back?
Thanks
Printable View
Hi,
Is there any way to search for string backward ? I have a Richtextbox that contain a text and the user search for staring, how can i search back?
Thanks
If you have VB6 check out the InStrRev function in the MSDN library.
Good luck!
See if my code would help you. Open a new project and put a text box control on it. Erase Text caption in proporties.
Then just copy my code in.
Option Explicit
Private Sub Form_Load()
'Looking for a space starting from the end of the string
Dim i As Integer
dim iSpace As Integer
Text1 = "I like to go out once in a while"
y = 1
For i = Len(Text1) To 1 Step -1
iSpace = InStr(i, Mid(Text1, 1, i), " ")
If iSpace > 0 Then
MsgBox "Found space in position " & iSpace
End If
Next
End Sub
Let me know if it would help you.
Hi,
mlana the "Joacim Andersson" method was much faster !
Thanks for the reply
P.S. - can Search in RichTextbox - in 1 command the all occures that iam looking for??
Thnks again
Thank you for letting me know that.
But I am working with VB5 and I did not find this function
there. Am I missing something or it is new for VB6?
InStrRev is a new function in VB6.
Joacim
In the RichTextBox there is a command "Find", Do u know if there any option to find ALL search argument in 1 command without any loop? (i am editing a large amount of data and the user like to search the textbox?) what is the best way to do that?
Tia
There is no such options. You would have to use a loop.
Good luck!
Thanks To All Replyers...