|
-
May 3rd, 2009, 01:36 PM
#1
Thread Starter
Addicted Member
How Do You Save Whatever's In The Clipboard To An Object?
Hi, I need to save the users clipboard contents to an object before I modify the clipboard, but I don't know how to do it. Any help is appreciated,
Thanks
Louix
-
May 3rd, 2009, 01:41 PM
#2
Re: How Do You Save Whatever's In The Clipboard To An Object?
Here's an example of getting text from the clipboard - to get other data types you just change the Data Format. If you delete the .Text after "DataFormats." intellisense will show you the different types.
Code:
Public Function GetClipboardText() As String
Dim objClipboard As IDataObject = Clipboard.GetDataObject()
With objClipboard
If .GetDataPresent(DataFormats.Text) Then Return .GetData(DataFormats.Text)
End With
End Function
-
May 3rd, 2009, 01:49 PM
#3
Thread Starter
Addicted Member
Re: How Do You Save Whatever's In The Clipboard To An Object?
Thank you 
this isn't quite what I was looking for, I said whatever's in the clipboard. Is there any way to get the format of the data in there then apply it to your code?
-
May 3rd, 2009, 02:00 PM
#4
Re: How Do You Save Whatever's In The Clipboard To An Object?
Well you can use the Clipboard.GetDataPresent function for each of the possible types in turn to see if there is an object of said type. (Bear in mind the clipboard could contain one of each possible format at any given time, ie just because it has some text doesn't mean it doesn't also have a TIFF or a File)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|