473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to Copy/Paste to clipboard ??

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
Nov 22 '06 #1
8 2581
On Wed, 22 Nov 2006 06:11:02 -0800, serge calderara wrote:
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 never been able to pass an object in the clipboard, and I think this
is by design. The only solution is to serialize the object and put that in
the clipboard.
I do this for our system, and the advantage is that you then allow pasting
between different applications without requiring the same DLLs be shared.
You also have to do this to drag-drop between applications, as this uses
the same concepts as cut/paste.

I create my own serializable DragData Object that contains all the info I
want to cut/paste, and this allows me to create a tidy 'packet' with all
the associated metadata to reconstruct my objects when deserialized.

Cheers,
Gadget
Nov 22 '06 #2
Thnaks for your reply.
I have never done this, could you brifly explain me hoe to do it ?

regards
serge

"Gadget" wrote:
On Wed, 22 Nov 2006 06:11:02 -0800, serge calderara wrote:
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 never been able to pass an object in the clipboard, and I think this
is by design. The only solution is to serialize the object and put that in
the clipboard.
I do this for our system, and the advantage is that you then allow pasting
between different applications without requiring the same DLLs be shared.
You also have to do this to drag-drop between applications, as this uses
the same concepts as cut/paste.

I create my own serializable DragData Object that contains all the info I
want to cut/paste, and this allows me to create a tidy 'packet' with all
the associated metadata to reconstruct my objects when deserialized.

Cheers,
Gadget
Nov 23 '06 #3
On Wed, 22 Nov 2006 23:37:01 -0800, calderara wrote:
Thnaks for your reply.
I have never done this, could you brifly explain me hoe to do it ?

regards
serge

"Gadget" wrote:
>On Wed, 22 Nov 2006 06:11:02 -0800, serge calderara wrote:
>>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 never been able to pass an object in the clipboard, and I think this
is by design. The only solution is to serialize the object and put that in
the clipboard.
I do this for our system, and the advantage is that you then allow pasting
between different applications without requiring the same DLLs be shared.
You also have to do this to drag-drop between applications, as this uses
the same concepts as cut/paste.

I create my own serializable DragData Object that contains all the info I
want to cut/paste, and this allows me to create a tidy 'packet' with all
the associated metadata to reconstruct my objects when deserialized.

Cheers,
Gadget
Look here:
http://support.microsoft.com/kb/815813
and a whole thread on using strings (which is what you want)
http://www.thescripts.com/forum/thread175771.html

Remember, "Google is your friend".

Cheers,
Gadget
Nov 23 '06 #4
Thnaks for the links.
I have try to implement but when I create a new XMLSerializer object, then I
get an exception error saying "Error reflecting type PluginApp.PlugInReport"

here is my code

=====>
Dim s As System.Xml.Serialization.XmlSerializer = New
System.Xml.Serialization.XmlSerializer(GetType(Plu ginApp.PlugInReport))

Dim txtWriter As System.IO.TextWriter = New
System.IO.StreamWriter("f:\report.xml")

s.Serialize(txtWriter, CType(tvReport.SelectedNode.Tag,
PluginApp.PlugInReport))
I have set for the class that I want to serialize a <Serializableattributes
<<<<<=====
Any idea what is wrong ?
Do I miss something
regards
serge

"Gadget" wrote:
On Wed, 22 Nov 2006 23:37:01 -0800, calderara wrote:
Thnaks for your reply.
I have never done this, could you brifly explain me hoe to do it ?

regards
serge

"Gadget" wrote:
On Wed, 22 Nov 2006 06:11:02 -0800, serge calderara wrote:

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 never been able to pass an object in the clipboard, and I think this
is by design. The only solution is to serialize the object and put that in
the clipboard.
I do this for our system, and the advantage is that you then allow pasting
between different applications without requiring the same DLLs be shared.
You also have to do this to drag-drop between applications, as this uses
the same concepts as cut/paste.

I create my own serializable DragData Object that contains all the info I
want to cut/paste, and this allows me to create a tidy 'packet' with all
the associated metadata to reconstruct my objects when deserialized.

Cheers,
Gadget

Look here:
http://support.microsoft.com/kb/815813
and a whole thread on using strings (which is what you want)
http://www.thescripts.com/forum/thread175771.html

Remember, "Google is your friend".

Cheers,
Gadget
Nov 24 '06 #5
On Fri, 24 Nov 2006 01:30:01 -0800, calderara wrote:
Thnaks for the links.
I have try to implement but when I create a new XMLSerializer object, then I
get an exception error saying "Error reflecting type PluginApp.PlugInReport"

here is my code

=====>
Dim s As System.Xml.Serialization.XmlSerializer = New
System.Xml.Serialization.XmlSerializer(GetType(Plu ginApp.PlugInReport))

Dim txtWriter As System.IO.TextWriter = New
System.IO.StreamWriter("f:\report.xml")

s.Serialize(txtWriter, CType(tvReport.SelectedNode.Tag,
PluginApp.PlugInReport))
I have set for the class that I want to serialize a <Serializableattributes
<<<<<=====
Any idea what is wrong ?
Do I miss something
regards
serge

"Gadget" wrote:
>On Wed, 22 Nov 2006 23:37:01 -0800, calderara wrote:
>>Thnaks for your reply.
I have never done this, could you brifly explain me hoe to do it ?

regards
serge

"Gadget" wrote:

On Wed, 22 Nov 2006 06:11:02 -0800, serge calderara wrote:

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 never been able to pass an object in the clipboard, and I think this
is by design. The only solution is to serialize the object and put that in
the clipboard.
I do this for our system, and the advantage is that you then allow pasting
between different applications without requiring the same DLLs be shared.
You also have to do this to drag-drop between applications, as this uses
the same concepts as cut/paste.

I create my own serializable DragData Object that contains all the info I
want to cut/paste, and this allows me to create a tidy 'packet' with all
the associated metadata to reconstruct my objects when deserialized.

Cheers,
Gadget

Look here:
http://support.microsoft.com/kb/815813
and a whole thread on using strings (which is what you want)
http://www.thescripts.com/forum/thread175771.html

Remember, "Google is your friend".

Cheers,
Gadget
You will have to find what it is in your PlugInReport that is not
serializable. Simply setting the attribute is not enough.
Look at the details in the exception to find why it couldn't serialize it.

Cheers,
Gadget
Nov 24 '06 #6
Hi

I have still one question. I can control class reference or object of my own
to verify if there are serializable or not but if my library is using for
instance Crystal report reference object, I cannot change anything in that
library if it is not serializable...

What to do then ?

thnaks for help
regards

"Gadget" wrote:
On Fri, 24 Nov 2006 01:30:01 -0800, calderara wrote:
Thnaks for the links.
I have try to implement but when I create a new XMLSerializer object, then I
get an exception error saying "Error reflecting type PluginApp.PlugInReport"

here is my code

=====>
Dim s As System.Xml.Serialization.XmlSerializer = New
System.Xml.Serialization.XmlSerializer(GetType(Plu ginApp.PlugInReport))

Dim txtWriter As System.IO.TextWriter = New
System.IO.StreamWriter("f:\report.xml")

s.Serialize(txtWriter, CType(tvReport.SelectedNode.Tag,
PluginApp.PlugInReport))
I have set for the class that I want to serialize a <Serializableattributes
<<<<<=====
Any idea what is wrong ?
Do I miss something
regards
serge

"Gadget" wrote:
On Wed, 22 Nov 2006 23:37:01 -0800, calderara wrote:

Thnaks for your reply.
I have never done this, could you brifly explain me hoe to do it ?

regards
serge

"Gadget" wrote:

On Wed, 22 Nov 2006 06:11:02 -0800, serge calderara wrote:

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 never been able to pass an object in the clipboard, and I think this
is by design. The only solution is to serialize the object and put that in
the clipboard.
I do this for our system, and the advantage is that you then allow pasting
between different applications without requiring the same DLLs be shared.
You also have to do this to drag-drop between applications, as this uses
the same concepts as cut/paste.

I create my own serializable DragData Object that contains all the info I
want to cut/paste, and this allows me to create a tidy 'packet' with all
the associated metadata to reconstruct my objects when deserialized.

Cheers,
Gadget
Look here:
http://support.microsoft.com/kb/815813
and a whole thread on using strings (which is what you want)
http://www.thescripts.com/forum/thread175771.html

Remember, "Google is your friend".

Cheers,
Gadget

You will have to find what it is in your PlugInReport that is not
serializable. Simply setting the attribute is not enough.
Look at the details in the exception to find why it couldn't serialize it.

Cheers,
Gadget
Nov 27 '06 #7
On Sun, 26 Nov 2006 23:53:01 -0800, calderara wrote:
Hi

I have still one question. I can control class reference or object of my own
to verify if there are serializable or not but if my library is using for
instance Crystal report reference object, I cannot change anything in that
library if it is not serializable...

What to do then ?

thnaks for help
regards

"Gadget" wrote:
>On Fri, 24 Nov 2006 01:30:01 -0800, calderara wrote:
>>Thnaks for the links.
I have try to implement but when I create a new XMLSerializer object, then I
get an exception error saying "Error reflecting type PluginApp.PlugInReport"

here is my code

=====>
Dim s As System.Xml.Serialization.XmlSerializer = New
System.Xml.Serialization.XmlSerializer(GetType(P luginApp.PlugInReport))

Dim txtWriter As System.IO.TextWriter = New
System.IO.StreamWriter("f:\report.xml")

s.Serialize(txtWriter, CType(tvReport.SelectedNode.Tag,
PluginApp.PlugInReport))
I have set for the class that I want to serialize a <Serializableattributes
<<<<<=====
Any idea what is wrong ?
Do I miss something
regards
serge

"Gadget" wrote:

On Wed, 22 Nov 2006 23:37:01 -0800, calderara wrote:

Thnaks for your reply.
I have never done this, could you brifly explain me hoe to do it ?
>
regards
serge
>
"Gadget" wrote:
>
>On Wed, 22 Nov 2006 06:11:02 -0800, serge calderara wrote:
>>
>>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 never been able to pass an object in the clipboard, and I think this
>is by design. The only solution is to serialize the object and put that in
>the clipboard.
>I do this for our system, and the advantage is that you then allow pasting
>between different applications without requiring the same DLLs be shared.
>You also have to do this to drag-drop between applications, as this uses
>the same concepts as cut/paste.
>>
>I create my own serializable DragData Object that contains all the info I
>want to cut/paste, and this allows me to create a tidy 'packet' with all
>the associated metadata to reconstruct my objects when deserialized.
>>
>Cheers,
> Gadget
>>

Look here:
http://support.microsoft.com/kb/815813
and a whole thread on using strings (which is what you want)
http://www.thescripts.com/forum/thread175771.html

Remember, "Google is your friend".

Cheers,
Gadget

You will have to find what it is in your PlugInReport that is not
serializable. Simply setting the attribute is not enough.
Look at the details in the exception to find why it couldn't serialize it.

Cheers,
Gadget
The only option is to (if possible) create a special class that can store
all the parameters used to recreate an instance of your object.
I do this in one of our systems. We have tree structures you can drag
around, where nodes have references to items in lists.
I have a class with a tree node and another property into which I copy all
the lists the original tree would have referenced.

There is no easy workaround, we just have to work with what we have :)

Cheers,
Gadget
Nov 27 '06 #8
Thanks for the tip..
I will do that

regards
serge

"Gadget" wrote:
On Sun, 26 Nov 2006 23:53:01 -0800, calderara wrote:
Hi

I have still one question. I can control class reference or object of my own
to verify if there are serializable or not but if my library is using for
instance Crystal report reference object, I cannot change anything in that
library if it is not serializable...

What to do then ?

thnaks for help
regards

"Gadget" wrote:
On Fri, 24 Nov 2006 01:30:01 -0800, calderara wrote:

Thnaks for the links.
I have try to implement but when I create a new XMLSerializer object, then I
get an exception error saying "Error reflecting type PluginApp.PlugInReport"

here is my code

=====>
Dim s As System.Xml.Serialization.XmlSerializer = New
System.Xml.Serialization.XmlSerializer(GetType(Pl uginApp.PlugInReport))

Dim txtWriter As System.IO.TextWriter = New
System.IO.StreamWriter("f:\report.xml")

s.Serialize(txtWriter, CType(tvReport.SelectedNode.Tag,
PluginApp.PlugInReport))
I have set for the class that I want to serialize a <Serializableattributes
<<<<<=====
Any idea what is wrong ?
Do I miss something
regards
serge

"Gadget" wrote:

On Wed, 22 Nov 2006 23:37:01 -0800, calderara wrote:

Thnaks for your reply.
I have never done this, could you brifly explain me hoe to do it ?

regards
serge

"Gadget" wrote:

On Wed, 22 Nov 2006 06:11:02 -0800, serge calderara wrote:
>
>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 never been able to pass an object in the clipboard, and I think this
is by design. The only solution is to serialize the object and put that in
the clipboard.
I do this for our system, and the advantage is that you then allow pasting
between different applications without requiring the same DLLs be shared.
You also have to do this to drag-drop between applications, as this uses
the same concepts as cut/paste.
>
I create my own serializable DragData Object that contains all the info I
want to cut/paste, and this allows me to create a tidy 'packet' with all
the associated metadata to reconstruct my objects when deserialized.
>
Cheers,
Gadget
>

Look here:
http://support.microsoft.com/kb/815813
and a whole thread on using strings (which is what you want)
http://www.thescripts.com/forum/thread175771.html

Remember, "Google is your friend".

Cheers,
Gadget
You will have to find what it is in your PlugInReport that is not
serializable. Simply setting the attribute is not enough.
Look at the details in the exception to find why it couldn't serialize it.

Cheers,
Gadget

The only option is to (if possible) create a special class that can store
all the parameters used to recreate an instance of your object.
I do this in one of our systems. We have tree structures you can drag
around, where nodes have references to items in lists.
I have a class with a tree node and another property into which I copy all
the lists the original tree would have referenced.

There is no easy workaround, we just have to work with what we have :)

Cheers,
Gadget
Nov 27 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: tabonni | last post by:
Hello All I am creating an ASP page. There are a list of filename and checkbox next to it. When user checked all the documents they want and click ADD TO CLIPBOARD button. All filepaths will be...
3
by: Tor Inge Rislaa | last post by:
Copy, Cut and Paste How to code the Copy, Cut and Paste functionality in VB.NET. In VB 6.0 I used the following code: 'For Copy Clipboard.Clear Clipboard.SetText...
5
by: DraguVaso | last post by:
Hi, I'm looking for a way to Copy and Paste Files to the clipboard. I found a lot of articles to copy pieces of text and bitmaps etc, but nog whole files. Whay I need is like you have in...
2
by: Keith | last post by:
I'm trying to come up with a way to create a contextmenu that will do all the "standard" functions (cut, copy, paste, undo, etc). There seems to be a lot of information out there - but nothing...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
6
by: Ben R. | last post by:
Hi, I've got a vb.net winforms app. Out of the box, I can use Ctrl X, C and V as expected in controls like textboxes. I've got a menustrip, and if I click the link "Add standard items" which...
9
by: Alan T | last post by:
Any source code example I can use to save the clipboard content to an object, then I will do a copy and paste, finally put back the 'saved' clipboard content back to clipboard ?
17
by: Steve | last post by:
I'm trying to code cut, copy, and paste in vb 2005 so that when the user clicks on a toolbar button, the cut/copy/paste will work with whatever textbox the cursor is current located in (I have...
8
by: jh | last post by:
I'd like to copy/paste into a listbox during runtime. I can do this for a textbox but can't figure out how to accomplish this for a listbox. Any help? Thanks.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.