V
V
Vladislav2018-08-24 12:54:50
Visual Basic
Vladislav, 2018-08-24 12:54:50

Why is a blank returned from the clipboard?

I add an object of my data type to the buffer.

My.Computer.Clipboard.SetData(MyObject.GetType.ToString, MyObject)

And then in another control I try to get it. Through ContainsData() it says that it is there, and through GetData(GetType(MyType).ToString()) it returns emptiness.
What's wrong?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Nikolai Bogdanov, 2018-08-27
@vbanykin

I support the previous speaker. You need to serialize the object into a stream of bytes (or xml) before buffering and deserialize after.

A
Alexander Yudakov, 2018-08-25
@AlexanderYudakov

Unfortunately, you cannot put objects on the clipboard.
Strings are allowed, bytes are allowed, objects are not.

S
sunblossom, 2018-08-24
@sunblossom

Maybe because there is an instance of a class in the buffer that doesn't have an override for Object.ToString()?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question