Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Richtextbox

HI Again to all

i have a program that needs to search a richtextbox for a version number , i have a textbox whixh holds this criteria call tex1 and the richtextbox gets information from my server ..

it pulls down the required information but along several other source information but i need to get my prgram to search for the contents of text1..

is this possible and if so . how would i go about getting this to work

many thanks in advande
Rob
[484 byte] By [Spumbu1977] at [2007-11-11 8:32:31]
# 1 Re: Richtextbox
You can use the Find method to search the contents of a RichTextBox.
pclement at 2007-11-11 17:25:19 >
# 2 Re: Richtextbox
thanks Paul.. it works great

thank you

i used the following code for all parties interested

RichTextBox1.Find ("" & Text1 & "")

thanks again
Spumbu1977 at 2007-11-11 17:26:19 >
# 3 Re: Richtextbox
Hi

i am in need of telling my app that when it finds the criteria it is looking for that ineed not to patch and if not it does need to patch but my if statement below seems to be giving me odd results, please could someone have a look and tell me where they think the problem might be

Private Sub Command2_Click()
rtfRichTextBox1.Find ("" & Text2 & "")
If rtfRichTextBox1.Find("" & Text2 & "") = True Then
MsgBox "Fully Patched"
Else
MsgBox "Need To Patch"
End If
End Sub

Many Thanks
Rob
Spumbu1977 at 2007-11-11 17:27:29 >
# 4 Re: Richtextbox
Rob,

You should only call the search once, the If..Endif is the correct place.

Also, the return value by the function is the starting position of the found text (if successful) or -1 if not.

-1 in VB equates to true so try testing for;

If rtfRichTextBox1.Find("" & Text2 & "") >-1 Then

Steve.
Steve Grant at 2007-11-11 17:28:22 >
# 5 Re: Richtextbox
thanks

that worked like a charm ..
thanks for the help

Rob
Spumbu1977 at 2007-11-11 17:29:24 >