472,119 Members | 1,690 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 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 43151
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Faith | last post: by
4 posts views Thread by Legendary Pansy | last post: by
3 posts views Thread by Rachel Suddeth | last post: by
7 posts views Thread by lgbjr | last post: by
reply views Thread by NetronProject | last post: by
2 posts views Thread by al_johnson222 | last post: by

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.