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

Clipboard question!

P: n/a
Lee
Hi,

How do i check to see if the clipboard is empty?

thanks in advance
lee
Sep 21 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
You cant check for completely empty in one call. You need to know what type
of data you are looking for. You can then call
Clipboard.ContainsData
and use the DataFormats object to get the appropriate parameter for the
function
e.g to check is there is a .net string on there:
Clipboard.ContainsData(DataFormats.StringFormat);

HTH

Ciaran O'Donnell

"Lee" wrote:
Hi,

How do i check to see if the clipboard is empty?

thanks in advance
lee
Sep 21 '06 #2

P: n/a
On Thu, 21 Sep 2006 10:53:17 +0100, Lee wrote:
Hi,

How do i check to see if the clipboard is empty?

thanks in advance
lee
IDataObject data = System.Windows.Forms.Clipboard.GetDataObject();
if (data == null)
// clipboard is empty
else
// clipboard has data
--
Tom Porterfield
Sep 21 '06 #3

P: n/a
Oh yes, I hadn't noticed that about it before. I have always looked for the
dataformat I was expecting.

Ciaran O'Donnell

"Tom Porterfield" wrote:
On Thu, 21 Sep 2006 10:53:17 +0100, Lee wrote:
Hi,

How do i check to see if the clipboard is empty?

thanks in advance
lee

IDataObject data = System.Windows.Forms.Clipboard.GetDataObject();
if (data == null)
// clipboard is empty
else
// clipboard has data
--
Tom Porterfield
Sep 21 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.