I'm using Clipboard.GetDataObject(); but sometimes it does not function like I need
This is the function I'm using
public String ClipboardGet()
{
IDataObject dataObj = Clipboard.GetDataObject();
if (!dataObj.GetDataPre开发者_StackOverflow社区sent(DataFormats.Text))
return "";
return dataObj.GetData(DataFormats.Text).ToString();
}
but sometimes it returns a empty string even when the data is text, how to handel this?
Have you tried Clipboard.GetText
or IDataObject.GetDataPresent(string, bool)
?
精彩评论