VB.Net TextBox Find, Replace text???

Joined
Oct 3, 2005
Messages
1
Reaction score
0
hi. i have been having a hard time figuring out how to "Find and Highlight" a string in one textbox, with a string from another text box. say, i have 3 text boxes, txtNotepad being the main body, somewhat like a notepad. on the bottom, i have 2 more TextBoxes. one for Find, txtFind, and another for txtReplace... with Find and replace, i have a button, for each. i have looked for samples, all i can find is VB 5.0 and 6.0 samples. i have updated the code, tweeked, just about everything i could and i just cant figure it out... could somebody please help me...
im new to this whole programming thing... im sure you can tell though.
-Thanks
 
Joined
Jun 13, 2005
Messages
148
Reaction score
0
ive only dabbled in .net but most vb 6. code should carry over

i would try sumin like this

dim varfindStart
dim varFindend
'integers

dim strfindword 'string

strfindword=txtfind.text

varfindstart=instr(1,txtnotepad.text,strFindWord,vbTextCompare)
varfindend= len(strFindword)

WITH txtnotepad
.SETFOCUS
.selSTART=VARFINDSTART
.SELLENGTH=VARFINDEND
END WITH
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top