PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms Richtextbox.find Method does not work as described, or am I stupid ?

Reply

Richtextbox.find Method does not work as described, or am I stupid ?

 
Thread Tools Rate Thread
Old 10-05-2004, 06:36 PM   #1
=?Utf-8?B?S2xhdXMgS2xvZXNlcg==?=
Guest
 
Posts: n/a
Default Richtextbox.find Method does not work as described, or am I stupid ?


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)
  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off