469,613 Members | 1,331 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,613 developers. It's quick & easy.

SEARCH&REPLACE in textBox

Could some one tell me how I can seach and replace only one word in a
textBox (THE FIRST WORD THAT COMES AFTER THE CURSOR). I already know how to
replace ALL , but I don't know how to REPLACE one, and how to SEARCH one and
select that point.

Thank in advance

Nov 15 '05 #1
1 1781
Tom
You need to change the .Text property of the textbox to whatever the new
text should be. Presumably, you'd the SelectionStart property to determine
where to start looking, then find the first space (or other delimiter) there
or after there by using the IndexOfAny() method on the string, then find the
next delimiter using the same method but starting later in the string.
Finaly you would reassemble the text by taking the appropriate substrings of
the original (before and after the word) and building a new string from
them.

"Tomomichi Amano" <to*********@hotmail.com> wrote in message
news:eK**************@TK2MSFTNGP11.phx.gbl...
Could some one tell me how I can seach and replace only one word in a
textBox (THE FIRST WORD THAT COMES AFTER THE CURSOR). I already know how to replace ALL , but I don't know how to REPLACE one, and how to SEARCH one and select that point.

Thank in advance

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Zenobia | last post: by
3 posts views Thread by tchurm | last post: by
1 post views Thread by Tomomichi Amano | last post: by
6 posts views Thread by DataSmash | last post: by
2 posts views Thread by Ola K | last post: by
6 posts views Thread by simon.robin.jackson | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.