469,632 Members | 1,631 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,632 developers. It's quick & easy.

How to determine is there any data stored on the clipboard in C#?

How to determine is there any data stored on the clipboard in C#?
Many thanks for your replying.
Jul 26 '07 #1
2 1372
Hi,
Try this code:
IDataObject d = Clipboard.GetDataObject();

if(d.GetDataPresent(DataFormats.Bitmap))
{
return "Bitmap data on clipboard!!";
}
else if(d.GetDataPresent(DataFormats.Text))
{
return (String)d.GetData(DataFormats.Text);
}
else
{
return "Unknown format of data is Contained on the clipboard.";
}

--
Hope this answers your question.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.

"vincent" wrote:
How to determine is there any data stored on the clipboard in C#?
Many thanks for your replying.
Jul 26 '07 #2
It is very helpful.
Thank you very much.

"Manish Bafna" wrote:
Hi,
Try this code:
IDataObject d = Clipboard.GetDataObject();

if(d.GetDataPresent(DataFormats.Bitmap))
{
return "Bitmap data on clipboard!!";
}
else if(d.GetDataPresent(DataFormats.Text))
{
return (String)d.GetData(DataFormats.Text);
}
else
{
return "Unknown format of data is Contained on the clipboard.";
}

--
Hope this answers your question.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.

"vincent" wrote:
How to determine is there any data stored on the clipboard in C#?
Many thanks for your replying.
Jul 26 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Nukeation | last post: by
1 post views Thread by keith | last post: by
4 posts views Thread by Aussie Rules | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.