Reputation: 1576
HI,
I have simple application which copy text from a textbox and paste it to another textbox.
It is working fine. Now I want to modify it .
Whenever user will click a button then he will select a text from a word file, the selected text should copy and paste into a textbox automatically.
May be this could be done using mouse up and down event but I am not sure.
Can somebody help me? I will be thankfull to you!!
Here is my code
Clipboard.SetDataObject(textBox1.Text,true);
if(Clipboard.GetDataObject().GetDataPresent(DataFormats.Text))
textBox2.Text = Clipboard.GetDataObject().GetData(DataFormats.Text).ToString();
Upvotes: 0
Views: 568
Reputation: 55059
I'm not sure if I understand exactly how it should work but I think you might be looking for the TextBox.SelectionChanged event, which is called when the selection in the Textbox has changed.
Upvotes: 1