G
Guest
Dear all,
I have an treeview control with different node object, I would like to
implement the Copy/Paste function of an object . For that I am using the
folowing function to copy teh object to clipboard :
====>
Private Sub CopyToClipboard(ByVal Obj As PluginApp.PlugInReport)
' Creates a new data format.
m_ClipObjFormat = DataFormats.GetFormat("ReportFormat")
' Creates a new object and store it in a DataObject using
myFormat
' as the type of format.
Dim m_ReportObject As New DataObject(m_ClipObjFormat.Name, Obj)
' Copies myObject into the clipboard.
Clipboard.SetDataObject(m_ReportObject)
End Sub
<=====
and the following object to get it back from clipboard
===>
Private Sub PasteFromClipboard(ByVal ObjFormat As DataFormats.Format)
' Performs some processing steps.
' Retrieves the data from the clipboard.
Dim m_RetrievedObject As IDataObject = Clipboard.GetDataObject()
' Converts the IDataObject type to MyNewObject type.
Dim myDereferencedObject As PluginApp.PlugInReport = _
CType(m_RetrievedObject.GetData(ObjFormat.Name),
PluginApp.PlugInReport)
' Print the value of the Object in a textBox.
m_PasteObject = myDereferencedObject
End Sub
<=======
Problem I have with that is that when I read back the clipboad I get an
empty object.
Either the object has never been copied or not read back properly.
WHat is wrong ?
thanks for help
serge
I have an treeview control with different node object, I would like to
implement the Copy/Paste function of an object . For that I am using the
folowing function to copy teh object to clipboard :
====>
Private Sub CopyToClipboard(ByVal Obj As PluginApp.PlugInReport)
' Creates a new data format.
m_ClipObjFormat = DataFormats.GetFormat("ReportFormat")
' Creates a new object and store it in a DataObject using
myFormat
' as the type of format.
Dim m_ReportObject As New DataObject(m_ClipObjFormat.Name, Obj)
' Copies myObject into the clipboard.
Clipboard.SetDataObject(m_ReportObject)
End Sub
<=====
and the following object to get it back from clipboard
===>
Private Sub PasteFromClipboard(ByVal ObjFormat As DataFormats.Format)
' Performs some processing steps.
' Retrieves the data from the clipboard.
Dim m_RetrievedObject As IDataObject = Clipboard.GetDataObject()
' Converts the IDataObject type to MyNewObject type.
Dim myDereferencedObject As PluginApp.PlugInReport = _
CType(m_RetrievedObject.GetData(ObjFormat.Name),
PluginApp.PlugInReport)
' Print the value of the Object in a textBox.
m_PasteObject = myDereferencedObject
End Sub
<=======
Problem I have with that is that when I read back the clipboad I get an
empty object.
Either the object has never been copied or not read back properly.
WHat is wrong ?
thanks for help
serge