Question Copying and Pasting from specific places

The-Don

Member
Joined
Feb 10, 2011
Messages
5
Programming Experience
1-3
I am trying to copy text from a standard rich text box on a button click. However, I only want the first 3575 characters to be copied to my second rich text box, and after the 3575 I want a further 8482 characters to be copied to my third. Is there a way to do this? Thanks in advance :)
 
Last edited:
You can set the SelectionStart and SelectionLength properties to select specific text. You can then get the SelectedText property value and do as you like with it, e.g. assign it to the Text of another control. You can do that multiple times to do different things with different parts of the text.
 
You can set the SelectionStart and SelectionLength properties to select specific text. You can then get the SelectedText property value and do as you like with it, e.g. assign it to the Text of another control. You can do that multiple times to do different things with different parts of the text.

Thanks, I got it working from that. For others, here is the working code for my problem:

TextBox1.SelectionStart = 0
TextBox1.SelectionLength = 3575
TextBox1.Copy()
TextBox2.Paste()
TextBox1.SelectionStart = 3575
TextBox1.SelectionLength = 8482
TextBox1.Copy()
TextBox3.Paste()
 
Back
Top