Clipboard Problems in VB.Net
Posted on 2006-10-20
I'm simply trying to copy/paste plain text strings from/to the clipboard. I've found some sample code on the internet (and here at EE) and it seems like it should be straight-forward. Strangely enough, my Clipboard object doesn't seem to have the methods these examples use, in particular SetDataObject() and GetDataObject().
I've got this code:
Private Sub BtnCopyToClipboardClick(sender As System.Object, e As System.EventArgs)
'Copy the selected text to the clipboard
Dim strX As String = txtText.SelectedText
'if no text is selected, copy the entire text
If strX.Length = 0 Then strX = txtText.Text
'Copy data if any to copy
If strX.Length > 0 Then
And I get this error:
error BC30456: 'SetDataObject' is not a member of 'Clipboard'.
The only methods that show up on my clipboard object are: Equals, Finalize, GetHashCode, GetType, and ToString.
Any idea what's going on?