F
fred
I am trying to Copy and paste using a custom format but I canot retrieve the
data.
In the main Form's class I have declared:
Dim myDocmanFormat as DataFormats.Format
then in the New Sub of the main form I have:
myDocmanFormat = DataFormats.GetFormat("DocmanFormat")
In the Copy sub I have:
Dim thisDataObject As New DataObject
Dim thisData As DocmanData = CType(thisNode.Tag, DocmanData).Clone
thisDataObject.SetData(Me.myDocmanFormat.Name, thisData)
Clipboard.SetDataObject(thisDataObject, True)
When I step through this part of the Copy routine "thisData" is definately
not Nothing. In the watch window I can access all of the properties of
"thisData".
In the Paste routine I have:
If Clipboard.GetDataObject.GetDataPresent(Me.myDocmanFormat.Name) Then
Dim myClipData As IDataObject = Clipboard.GetDataObject()
Dim DataFromClip As DocmanData =
CType(myClipData.GetData(Me.myDocmanFormat.Name), DocmanData)
Although the data format is present it always returns Nothing, that is
"DataFromClip" remains Nothing after executing the last line.
Can someone please tell me what I have done wrong.
Thanks,
Fred
data.
In the main Form's class I have declared:
Dim myDocmanFormat as DataFormats.Format
then in the New Sub of the main form I have:
myDocmanFormat = DataFormats.GetFormat("DocmanFormat")
In the Copy sub I have:
Dim thisDataObject As New DataObject
Dim thisData As DocmanData = CType(thisNode.Tag, DocmanData).Clone
thisDataObject.SetData(Me.myDocmanFormat.Name, thisData)
Clipboard.SetDataObject(thisDataObject, True)
When I step through this part of the Copy routine "thisData" is definately
not Nothing. In the watch window I can access all of the properties of
"thisData".
In the Paste routine I have:
If Clipboard.GetDataObject.GetDataPresent(Me.myDocmanFormat.Name) Then
Dim myClipData As IDataObject = Clipboard.GetDataObject()
Dim DataFromClip As DocmanData =
CType(myClipData.GetData(Me.myDocmanFormat.Name), DocmanData)
Although the data format is present it always returns Nothing, that is
"DataFromClip" remains Nothing after executing the last line.
Can someone please tell me what I have done wrong.
Thanks,
Fred