Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy, Cut, Paste

Status
Not open for further replies.

trenta87

Programmer
Oct 29, 2007
13
0
0
US
Does anyone know how to implement a copy, paste and cut function in my program. I want a base function which will copy cut and paste text from all textboxes current form

I want a copy paste cut button on my mdiparent form and this function to work on any form and all textboxes in the active form.

Please help!!
 
I would look to the My.Computer.Clipboard namespace. You will have to build the routines that grab the data and paste it to the new locations. I would probably build a CutPaste class that accepts FromForm and ToForm form variables. If you have the same textboxes, etc on each form, then the moving should be fairly straight forward.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
Example code for the "I can't google" people:
Code:
Dim strClipData As New String("")
For Each strItem As String In listBox1.Items
   strClipData += strItem.ToString.TrimEnd + vbLf
Next
Dim aDataObject As New DataObject()
aDataObject.SetData(DataFormats.Text, strClipData)
'Load Clipboard Data
Clipboard.SetDataObject(aDataObject)

-Sometimes the answer to your question is the hack that works
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top