|
-
Nov 12th, 2000, 01:31 PM
#1
Thread Starter
The picture isn't missing
I want to be able to find a specific text inside a RichTextBox and then if the text is found then it pops a message box out. i tried many different ways but still cant do it. please help me
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Nov 12th, 2000, 01:36 PM
#2
Use the RichTextBox's Find property.
Code:
RichTextBox1.Find "MyText"
RichTextBox1.SetFocus
Or you can use the Instr function.
Code:
If Instr(RichTextBox1.Text, "MyText") Then
Msgbox "Text found!"
Else
Msgbox "Text not found!"
End If
-
Nov 12th, 2000, 01:42 PM
#3
Thread Starter
The picture isn't missing
thanx. that works perfectly
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Nov 12th, 2000, 01:50 PM
#4
If you are using the first one, as you wanted a message box:
Code:
RichTextBox1.Find "MyText"
RichTextBox1.SetFocus
If RichTextBox1.SelText <> "" Then
MsgBox "Text found!"
Else
MsgBox "Text not found!"
End If
-
Nov 12th, 2000, 02:45 PM
#5
InStr can return the position of it as well.
Code:
nPosition = InStr(RTF1, "MyText")
-
Nov 12th, 2000, 03:46 PM
#6
transcendental analytic
If the purpose is just to find it, not specify it's position you can do it faster with like operator:
Code:
If RichTextBox1.Text, "*MyText*") Then
Msgbox "Text found!"
Else
Msgbox "Text not found!"
End If
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 12th, 2000, 07:22 PM
#7
Your code is somewhat faulty, Kedaman.
Code:
If RichTextBox1.Text Like "*MyText*" Then
MsgBox "Text found!"
Else
MsgBox "Text not found!"
End If
-
Nov 13th, 2000, 09:13 AM
#8
transcendental analytic
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|