By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,028 Members | 1,258 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,028 IT Pros & Developers. It's quick & easy.

Copy, Cut and Paste

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
"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

P: n/a
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.