Hi,
I am trying to put my custom object in the Clipboard but when I try to
retrive, I get "Nothing".
Let me show you how I am doing this,
' putting data into the clipboard
Dim dataObj As New System.Windows.Forms.DataObject
dataObj.SetData(System.Windows.Forms.DataFormats.GetFormat("MyClass").Name,
False, objOfMyClass)
System.Windows.Forms.Clipboard.SetDataObject(dataObj)
' retrieving from clipboard
Dim dtObj As System.windows.forms.IDataObject =
System.Windows.Forms.Clipboard.GetDataObject()
If
dtObj.GetDataPresent(System.Windows.Forms.DataFormats.GetFormat("MyClass").Name)
Then
objOfMyClass =
CType(dtObj.GetData(System.Windows.Forms.DataFormats.GetFormat("MyClass").Name,
False), MyClass)
End If
I am getting "True" from the following command
dtObj.GetDataPresent(System.Windows.Forms.DataFormats.GetFormat("MyClass").Name
But "Nothing" from the following one
dtObj.GetData(System.Windows.Forms.DataFormats.GetFormat("MyClass").Name,
False)
Please give your suggestions how can I fix it.
Regards,
Naeem