Text processing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • roxana
    New Member
    • Aug 2008
    • 1

    Text processing

    Hi all! I have a question about text processing in a richtextbox. As I mentioned I have a richtextbox which I have added some file names to it dynamically. All of the names are divided by ";". I want to delete the whole name between two semicolons if someone pressed the "Delete" or "Back space" keys. I don't know for example if the cursor located in the middle of the text how can I detect the whole file name.

    Thanks in advance for your answers
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    So does your RichTextBox control have only one line?

    Comment

    • cloud255
      Recognized Expert Contributor
      • Jun 2008
      • 427

      #3
      Hi,

      well what i would do is create a function which searches for a ";" before the position of the cursor and the first semi-colon after the cursor, then i would highlight this section of text. from this point it will simply be a matter of telling the richtext control to delete the selected text.

      i would call the above described funtion OnKeyPress and OnMouseClick for the richtext box.

      do note that you will have to do some safety coding for if the user selects the first entry, i.e. it has no preceding semi-colon, in this case you would have to accept string[0] as the the preceding semi-colon.

      good luck

      Comment

      Working...