User defined Object in Clipboard

R

Rob T

I'm having problem pasting a user defined object that's put into the
clipboard....

Here's a crude example of what I'm trying to get done.

Dim fromShapes as Shapes 'shapes is my custom object
Dim toShapes as Shapes
Clipboard.SetDataObject(fromShapes) ' this works...I can see in
clipboard.exe that it has changed

Dim iData as IDataObject = Clipboard.GetDataObject
toShapes = iData.GetData("NOT SURE WHAT TO PUT HERE")

Thanks.
 
B

Brian Swanson

You should use:

toShapes = iData.GetData(toShapes.GetType)

Hope this helps,
Brian Swanson
 
R

Rob T

That always returns 'nothing'.

If I view the GetType in a watch window...there's a bunch of stuff in
there....not too sure what it all is. ;-)

Is there something in my object that need to define? For example, my Shapes
class looks something like this:

Public Class Shapes
Public Clr as color

public Class Line
Inherits Shapes
.....
end class

public Class Circle
Inherits Shapes
.........
end class
end class
 
G

Guest

I'm new to VB.Net but I believe you haven't instantiated the object. You
might try

Dim fromShapes as Shapes = NEW SHAPES 'shapes is my custom object
 
R

Rob T

Sorry about that. I didn't enter it in my example...my real code, I did
have new in there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top