Results 1 to 9 of 9

Thread: Search Back

  1. #1

    Thread Starter
    Addicted Member Tiovital's Avatar
    Join Date
    Apr 2000
    Posts
    249
    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

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    If you have VB6 check out the InStrRev function in the MSDN library.

    Good luck!

  3. #3
    Member
    Join Date
    Jan 1999
    Posts
    41
    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.


  4. #4

    Thread Starter
    Addicted Member Tiovital's Avatar
    Join Date
    Apr 2000
    Posts
    249
    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


  5. #5
    Member
    Join Date
    Jan 1999
    Posts
    41
    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?

  6. #6
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    InStrRev is a new function in VB6.

  7. #7

    Thread Starter
    Addicted Member Tiovital's Avatar
    Join Date
    Apr 2000
    Posts
    249
    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

  8. #8
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    There is no such options. You would have to use a loop.

    Good luck!

  9. #9

    Thread Starter
    Addicted Member Tiovital's Avatar
    Join Date
    Apr 2000
    Posts
    249

    Thanks


    Thanks To All Replyers...



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width