searching text in richtextbox

This is a discussion on searching text in richtextbox within the C# Programming forums, part of the General Programming Boards category; Hi: I was trying to find the required text in richtextBox, just like the find function in the office. I've ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    173

    searching text in richtextbox

    Hi:
    I was trying to find the required text in richtextBox, just like the find function in the office.
    I've used indexof(), but it was not fitting the exact text, if the word in richtextBox is longer than the searching text, it also returns.
    and I don't know how to search the whole content in richtextBox, it always stopped when found the first fitted text and how to hightlight the matched texts or set colors to them?

    Thank you!
    Don't laugh at me,I am just a SuperNewbie.

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    173
    Ok, I've known the ways of finding the text in richtextBox, but the only problem I get is that it always stops when the text is matched, and not going to continue searching, what should i do?
    thanks
    Don't laugh at me,I am just a SuperNewbie.

  3. #3
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,138
    If the first you find is not what you need, continue the search and specify the index+1 you found on the first try as second parameter. Build a loop to find all.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    173
    so, you mean the parameter for richtextbox.Find() function?
    Don't laugh at me,I am just a SuperNewbie.

  5. #5
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,138
    I was refering to the IndexOf method. Look it up on www.msdn.microsoft.com
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A bunch of Linker Errors...
    By Junior89 in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2006, 01:59 PM
  2. searching a text file for a word
    By satory in forum C Programming
    Replies: 5
    Last Post: 02-22-2005, 12:04 PM
  3. Searching A Text File?
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 07-03-2002, 04:57 AM
  4. Validating the contents of a char buffer
    By mattz in forum C Programming
    Replies: 3
    Last Post: 12-09-2001, 05:21 PM
  5. Moving to the next structure array
    By mattz in forum C Programming
    Replies: 2
    Last Post: 11-30-2001, 02:43 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21