469,935 Members | 1,924 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,935 developers. It's quick & easy.

multiple formats on the clipboard

I am trying to put a FileDrop format and a Text format dataobject onto the
clipboard so that they are both available.
I seem to be able to do one or the other but when I try to put both on only
the last entry is available on the clipboard.

Dim FileDataObject As New DataObject
Dim TextDataObject As New DataObject
Dim FileNames() As String = {myFileName}
FileDataObject.SetData(DataFormats.FileDrop, FileNames)
Clipboard.SetDataObject(FileDataObject, True)
TextDataObject.SetData(DataFormats.Text, myFileName)
Clipboard.SetDataObject(TextDataObject, True)

If I run the above statements only the Text format data is available on the
clipboard. If I comment out the last line then the File Format data is
available.
Since they are different formats shouldn't they both be available at the
same time.
What am I doing wrong. How do I get both formats onto the clipboard.

Thanks,
Fred
Nov 20 '05 #1
3 2149
"fred" <So***@NoSpam.com> schrieb
I am trying to put a FileDrop format and a Text format dataobject
onto the clipboard so that they are both available.
I seem to be able to do one or the other but when I try to put both
on only the last entry is available on the clipboard.

Dim FileDataObject As New DataObject
Dim TextDataObject As New DataObject
Dim FileNames() As String = {myFileName}
FileDataObject.SetData(DataFormats.FileDrop, FileNames)
Clipboard.SetDataObject(FileDataObject, True)
TextDataObject.SetData(DataFormats.Text, myFileName)
Clipboard.SetDataObject(TextDataObject, True)

If I run the above statements only the Text format data is available
on the clipboard. If I comment out the last line then the File Format
data is available.
Since they are different formats shouldn't they both be available at
the same time.
What am I doing wrong. How do I get both formats onto the
clipboard.


You can only put /one/ object in the clipboard. The object might be returned
in different /formats/:

Const myFileName As String = "filename"

Dim FileDataObject As New DataObject
Dim FileNames() As String = {myFileName}

FileDataObject.SetData(DataFormats.FileDrop, FileNames)
FileDataObject.SetData(DataFormats.Text, myFileName)
Clipboard.SetDataObject(FileDataObject, True)
MsgBox(String.Join(vbCrLf, Clipboard.GetDataObject.GetFormats))

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
Thanks Armin.
I'd been mucking around with this for hours.
"Armin Zingler" <az*******@freenet.de> wrote in message
news:40***********************@news.freenet.de...
"fred" <So***@NoSpam.com> schrieb
I am trying to put a FileDrop format and a Text format dataobject
onto the clipboard so that they are both available.
I seem to be able to do one or the other but when I try to put both
on only the last entry is available on the clipboard.

Dim FileDataObject As New DataObject
Dim TextDataObject As New DataObject
Dim FileNames() As String = {myFileName}
FileDataObject.SetData(DataFormats.FileDrop, FileNames)
Clipboard.SetDataObject(FileDataObject, True)
TextDataObject.SetData(DataFormats.Text, myFileName)
Clipboard.SetDataObject(TextDataObject, True)

If I run the above statements only the Text format data is available
on the clipboard. If I comment out the last line then the File Format
data is available.
Since they are different formats shouldn't they both be available at
the same time.
What am I doing wrong. How do I get both formats onto the
clipboard.
You can only put /one/ object in the clipboard. The object might be

returned in different /formats/:

Const myFileName As String = "filename"

Dim FileDataObject As New DataObject
Dim FileNames() As String = {myFileName}

FileDataObject.SetData(DataFormats.FileDrop, FileNames)
FileDataObject.SetData(DataFormats.Text, myFileName)
Clipboard.SetDataObject(FileDataObject, True)
MsgBox(String.Join(vbCrLf, Clipboard.GetDataObject.GetFormats))

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
Thanks Armin.
I'd been mucking around with this for hours.
"Armin Zingler" <az*******@freenet.de> wrote in message
news:40***********************@news.freenet.de...
"fred" <So***@NoSpam.com> schrieb
I am trying to put a FileDrop format and a Text format dataobject
onto the clipboard so that they are both available.
I seem to be able to do one or the other but when I try to put both
on only the last entry is available on the clipboard.

Dim FileDataObject As New DataObject
Dim TextDataObject As New DataObject
Dim FileNames() As String = {myFileName}
FileDataObject.SetData(DataFormats.FileDrop, FileNames)
Clipboard.SetDataObject(FileDataObject, True)
TextDataObject.SetData(DataFormats.Text, myFileName)
Clipboard.SetDataObject(TextDataObject, True)

If I run the above statements only the Text format data is available
on the clipboard. If I comment out the last line then the File Format
data is available.
Since they are different formats shouldn't they both be available at
the same time.
What am I doing wrong. How do I get both formats onto the
clipboard.
You can only put /one/ object in the clipboard. The object might be

returned in different /formats/:

Const myFileName As String = "filename"

Dim FileDataObject As New DataObject
Dim FileNames() As String = {myFileName}

FileDataObject.SetData(DataFormats.FileDrop, FileNames)
FileDataObject.SetData(DataFormats.Text, myFileName)
Clipboard.SetDataObject(FileDataObject, True)
MsgBox(String.Join(vbCrLf, Clipboard.GetDataObject.GetFormats))

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Richard Hollenbeck | last post: by
reply views Thread by Hai NIng | last post: by
1 post views Thread by ljlevend | last post: by
4 posts views Thread by Thom Little | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.