473,322 Members | 1,494 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Copy, Cut and Paste

Copy, Cut and Paste

How to code the Copy, Cut and Paste functionality in VB.NET. In VB 6.0 I
used the following code:
'For Copy

Clipboard.Clear
Clipboard.SetText ActiveForm.ActiveControl.SelText, vbCFText

'For Cut
Clipboard.Clear
Clipboard.SetText ActiveForm.ActiveControl.SelText, vbCFText
ActiveForm.ActiveControl.SelText = ""

'For Paste
If Clipboard.GetFormat(vbCFText) Then
ActiveForm.ActiveControl.SelText = Clipboard.GetText(vbCFText)
End If

T.I.Rislaa

Nov 20 '05 #1
3 43322
Hi,

To copy :
Clipboard.SetDataObject(TextBox1.Text)

To paste:
Label1.Text = Clipboard.GetDataObject().GetData(DataFormats.Text )

Let me know if it works.

- Gary -
"Tor Inge Rislaa" <to*************@rislaa.no> wrote in message
news:Fi********************@news2.e.nsc.no...
Copy, Cut and Paste

How to code the Copy, Cut and Paste functionality in VB.NET. In VB 6.0 I
used the following code:
'For Copy

Clipboard.Clear
Clipboard.SetText ActiveForm.ActiveControl.SelText, vbCFText

'For Cut
Clipboard.Clear
Clipboard.SetText ActiveForm.ActiveControl.SelText, vbCFText
ActiveForm.ActiveControl.SelText = ""

'For Paste
If Clipboard.GetFormat(vbCFText) Then
ActiveForm.ActiveControl.SelText = Clipboard.GetText(vbCFText)
End If

T.I.Rislaa

Nov 20 '05 #2
"Tor Inge Rislaa" <to*************@rislaa.no> schrieb
Copy, Cut and Paste

How to code the Copy, Cut and Paste functionality in VB.NET. In VB
6.0 I used the following code:
'For Copy

Clipboard.Clear
Clipboard.SetText ActiveForm.ActiveControl.SelText, vbCFText

'For Cut
Clipboard.Clear
Clipboard.SetText ActiveForm.ActiveControl.SelText, vbCFText
ActiveForm.ActiveControl.SelText = ""

'For Paste
If Clipboard.GetFormat(vbCFText) Then
ActiveForm.ActiveControl.SelText = Clipboard.GetText(vbCFText)
End If

T.I.Rislaa


VS 2003:

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB/vbcon/html/vxconChangesToClipboard
ObjectInVisualBasicNET.htm

(see hints in signature)
--
Armin

- Links might be split into two lines. Concatenate them using notepad.
- Links might require to add a ".nnnn" after the "2003FEB", e.g.
"2003FEB.1033" for localized versions.
- Links starting with "ms-help" are URLs for the document explorer (<F1>).
Paste them in the URL textbox and press enter. Using internal help (menu
tools -> options -> environment -> help), display the "Web" toolbar that
contains the textbox.

Nov 20 '05 #3
Hello,

"Tor Inge Rislaa" <to*************@rislaa.no> schrieb:
How to code the Copy, Cut and Paste functionality in
VB.NET. In VB 6.0 I used the following code:


Sample for using the clipboard:

http://www.mvps.org/dotnet/dotnet/samples/controls/
-> "RichTextBoxContext"

HTH,
Herfried K. Wagner
--
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: The Flyer | last post by:
Hi Sorry for posting this message to so many groups, but I was not sure which group the windows keyboard experts would be reading, so I ventured to post it to all of them. I want to map or...
3
by: Faith | last post by:
Hello. I need to take a column from Excel(unknown amount of rows) that will be selected by the user and copy those cells. Then I will need to paste those cells into the first column in a Data...
4
by: Legendary Pansy | last post by:
I was checking out the 101 C# Samples, specifically Windows Forms - Use the Clipboard. I took a look at the code for a while, and I understand what the program is doing with the cut, copy, pasting...
3
by: Rachel Suddeth | last post by:
This may not be the right forum, but it's a problem I chiefly come across when trying to post here. When I do a copy/paste from VS, the text always looks really weird (and even if I'm in an...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
0
by: NetronProject | last post by:
My copy/paste operation results in a MemoryStream full of '\0' characters on the Clipboard. Maybe my approach to copy/paste is wrong when handling generic types. All entries in the CollectionBase...
0
by: squirrelonfire | last post by:
Hi I run postgreSQL from a remote server like this SSH -X cnguyen_db@okaram.spsu.edu ....enter the password Then I run bluefish& and psql The problem I'm having is that I can't copy and paste...
2
by: al_johnson222 | last post by:
>From any page, I want to be able to call a JS function that will do the equivelant of select all, and copy. This data will then be posted to a page that will log it. This would be easy using...
8
by: jh | last post by:
I'd like to copy/paste into a listbox during runtime. I can do this for a textbox but can't figure out how to accomplish this for a listbox. Any help? Thanks.
3
by: questionit | last post by:
Some websites disable the Windows copy and paste feature to use on thier website. A text can not be copied and pasted either from using shortcuts : CTRL+C, CTRL+V or from using copy, paste option...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.