Click to See Complete Forum and Search --> : seacrching for a specified text from a string.


Sopok
May 3rd, 2001, 09:37 PM
Hi all,
i have this problem... i don't have any idea on how to search or find or findout what is in a string. For instance i have a string '123' and i want to know whether the string '123' contains a '2'.... it must sound simple but i've tried everything i know and still can't get it. pls...help...me..

cksiow
May 3rd, 2001, 10:10 PM
try this



dim s as string
dim l as long

s = "123"
l = instr(1,s,"2") 'should return 2 to l, the position where the char "2" occur

s = "123"
l = instr(1,s,"4") 'should return 0 to l, as no char "4" found in string s.




HTH

cksiow
http://vblib.virtualave.net - share our codes

Robert Moy
May 4th, 2001, 10:56 PM
Hello:

You can also do this: You can textbox and Richtextbox to find String.

RichTextBox2.UpTo (Text1.Text)
RichTextBox2.SetFocus

However, the cursor must before the String to be searched.
You can find more information about it on the Visual Basic 6:Black Book by Steven Holzner.

Good Luck