Replacing selected text in a string
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.
精彩评论