G
Guest
I put an instance of a class of mine in the clipboard and when I try to get it back the clipboard reports that it contains the format I am asking for, but then returns null
The code is as following
// copy
IDataObject iData = new DataObject()
// myClass is [Serializable] and contains only string and int public member
myClass data = new myClass()
iData.SetData( typeof( myClass ), data )
Clipboard.SetDataObject( iData, false )
// past
IDataObject iData = Clipboard.GetDataObject()
if ( iData.GetDataPresent( typeof( myClass ) )
// here null is always returne
myClass data = (myClass)iData.GetData( typeof( myClass ) )
I have read postings from other people in various places asking help on variations of this problem, but there has never been a conclusive answer. Could it be a bug?
Thanks
Raul Rosentha
The code is as following
// copy
IDataObject iData = new DataObject()
// myClass is [Serializable] and contains only string and int public member
myClass data = new myClass()
iData.SetData( typeof( myClass ), data )
Clipboard.SetDataObject( iData, false )
// past
IDataObject iData = Clipboard.GetDataObject()
if ( iData.GetDataPresent( typeof( myClass ) )
// here null is always returne
myClass data = (myClass)iData.GetData( typeof( myClass ) )
I have read postings from other people in various places asking help on variations of this problem, but there has never been a conclusive answer. Could it be a bug?
Thanks
Raul Rosentha