RichtextBox behavior

  • Thread starter Thread starter Pascal
  • Start date Start date
P

Pascal

hello
When man double-clicks on a word in a rtb then the word is selected. But
when in the text, there are two words like these : "J'aimerai bien trouver
une solution." and I double-click on the word "aimerai" : all this text is
selected : "J'aimerais" .

Is it possible to change the behavior of the RTB, in a simple manner so that
the selection stops before the apostrophe?
thanks
pascal
 
hello
When man double-clicks on a word in a rtb then the word is selected. But
when in the text, there are two words like these : "J'aimerai bien trouver
une solution." and I double-click on the word "aimerai" : all this text is
selected : "J'aimerais" .

Is it possible to change the behavior of the RTB, in a simple manner so that
the selection stops before the apostrophe?
thanks
pascal

Hi,

Try this algorithm.

/////////////////////////////////
' Assuming you have a word having one apostrophe:

Private Sub RichTextBox1_DoubleClick(ByVal sender _
As System.Object, ByVal e As System.EventArgs) _
Handles RichTextBox1.DoubleClick

Dim str As String = RichTextBox1.SelectedText


If str.Contains("'") Then

Dim wordtoselect As String = str.Split("'")(1)
RichTextBox1.Select(str.IndexOf(wordtoselect.Substring(0)), _
wordtoselect.Length - 1)
End If

End Sub
/////////////////////////////////


Hope this helps,

Onur Güzel
 
hello
When man double-clicks on a word in a rtb then the word is selected. But
when in the text, there are two words like these : "J'aimerai bien
trouver une solution." and I double-click on the word "aimerai" : all
this text is selected : "J'aimerais" .

Is it possible to change the behavior of the RTB, in a simple manner so
that the selection stops before the apostrophe?
thanks
pascal

I thought that was your problem that was solved in another thread a few
days ago.
 
I think you can do what you want with
EM_SETWORDBREAKPROC. It sets up a
callback function that allows you to handle
wordwrap/wordbreak rules yourself. I've
never actually tried it myself.
 
Back
Top