PC Review


Reply
Thread Tools Rate Thread

Copy, Cut and Paste

 
 
Tor Inge Rislaa
Guest
Posts: n/a
 
      4th Sep 2003
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



 
Reply With Quote
 
 
 
 
Gary
Guest
Posts: n/a
 
      4th Sep 2003
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" <(E-Mail Removed)> wrote in message
news:FiC5b.19831$(E-Mail Removed)...
> 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
>
>
>



 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      4th Sep 2003
"Tor Inge Rislaa" <(E-Mail Removed)> 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.

 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      4th Sep 2003
Hello,

"Tor Inge Rislaa" <(E-Mail Removed)> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I get copy/paste to copy/paste text and not the whole page =?Utf-8?B?Q2Fyb2wgSi4=?= Microsoft Word Document Management 1 6th May 2005 09:03 PM
Copy and Paste macro needs to paste to a changing cell reference =?Utf-8?B?bG91bG91?= Microsoft Excel Programming 0 24th Feb 2005 10:29 AM
Copy & Paste Object without using the Excel Copy Paste functions =?Utf-8?B?R2Fueg==?= Microsoft Excel New Users 0 10th Mar 2004 07:06 AM
Copy & Paste Object without using the Excel Copy Paste functions =?Utf-8?B?R2Fueg==?= Microsoft Excel Misc 0 10th Mar 2004 07:06 AM
Re: Copy/Paste in Excel prints highlighted cells and does not paste Dave Peterson Microsoft Excel Misc 0 30th Jul 2003 11:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:03 AM.