PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Richtextbox.find Method does not work as described, or am I stupid ?
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Richtextbox.find Method does not work as described, or am I stupid ?
![]() |
Richtextbox.find Method does not work as described, or am I stupid ? |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi
The following function is a sample from the online documentation for VB.NE ---code-- Public Function FindMyText(ByVal searchText As String, ByVal searchStart As Integer, ByVal searchEnd As Integer) As Intege ' Initialize the return value to false by default Dim returnValue As Integer = - ' Ensure that a search string and a valid starting point are specified If searchText.Length > 0 And searchStart >= 0 The ' Ensure that a valid ending value is provided If searchEnd > searchStart Or searchEnd = -1 The ' Obtain the location of the search string in richTextBox1 Dim indexToText As Integer = RichTextBox1.Find(searchText, searchStart, searchEnd, RichTextBoxFinds.WholeWord ' Determine whether the text was found in richTextBox1 If indexToText >= 0 The ' Return the index to the specified search text returnValue = indexToTex End I End I End I Return returnValu End Functio ---code end-- the member function .Find gets a start parameter (int) and an end parameter, the documentation states, that if the end parameter is set to -1, the find is done backwards It does not do it that way, or did I misunderstand I want to automatically select complete words that were entered, using the KeyUp Event and looking for the previous blank or CRLF (which should be the character preceeding any word The start parameter I do set to RichTextBox1.SelectionStart -1 (remeber, the last character entered was a blank, which triggerd the event, so the last word entered ends at SelectionStart -1 Can anybody please hlep me in this th Klau RichTextBox1.Find(searchText, searchStart, searchEnd, RichTextBoxFinds.WholeWord) |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

