Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0VB.NET
I have 2 multiline textboxes in windows application, textbox1 and textbox2. I have data on both textboxes. I also have copy and paste button on form.
If i select textbox1 selected data and clicks on copy button ...then it should copy data that is selected and now i goto next textbox textbox2 and click on "paste".then it should paste the data that was selected from textbox1.
And in the same way for textbox2 to textbox1 data should be copied and paste....
Please suggest.....
Posted 22-Dec-12 23:28pm
Amol011573

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

There are a couple of ways you can do this:
1) You could use the actual windows clipboard: Clipboard.GetText[^] and Clipboard.SetText[^] are the easiest way to do it.
Or
2) You could create a class level string variable to hold the information. This is pretty easy, just copy the text in and out. Use this way if you don't want to disturb the actual clipboard content for other applications.
 
Either way, you just need to read the data out using the TextBox.SelectedText property and either set it it in the other TB, or set the TextBox.Text property if you want it to replace all the text.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 515
1 OriginalGriff 468
2 Abhinav S 305
3 sanket saxena 295
4 Tadit Dash 160
0 Sergey Alexandrovich Kryukov 8,482
1 OriginalGriff 4,830
2 Peter Leow 3,794
3 Maciej Los 3,515
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web02 | 2.8.140415.2 | Last Updated 23 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid