开发者

Replacing selected text in a string

开发者 https://www.devze.com 2023-01-24 08:35 出处:网络
I am selecting text using SelectText method in my string. I want to replace this text开发者_开发百科 but only the selected area. When I use Replace method, it replaces all words in the string. (e.g Th

I am selecting text using SelectText method in my string. I want to replace this text开发者_开发百科 but only the selected area. When I use Replace method, it replaces all words in the string. (e.g This Computer is a good Computer. I only selected last Computer and want to say, This computer is a goods machine.) It does This machine is a good machine, which I donot want.


TextBox1.SelectionStart = 24
TextBox1.SelectionLength = 8

TextBox1.Paste("machine")


can you look at SelectionStart and SelectionLength, cut out what you want to replace, then insert what you want.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号