473,396 Members | 1,726 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,396 software developers and data experts.

clipboard and a file

Hi to all, I would like to be able to copy & paste a file.
I think the file type in WinXP is the DataFormats.FileDrop. So I have an
object
....
IDataObject myObject = (IDataObject) ido.GetData(DataFormats.FileDrop);
....
but I receive this error:

"An unhandled exception of type 'System.InvalidCastException' occurred in
WindowsApplication1.exe
Additional information: Specified cast is not valid."

Any ideas?
Nov 16 '05 #1
1 1727
Marco,

If you assign the result of "ido.GetData(DataFormats.FileDrop)" to an
object, and look at it in the debugger, you should see the type of the
object that is returned.

ido is the IDataObject implementation though, the object returned will
not implement it.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Marco Osvaldo" <no****@nomail.it> wrote in message
news:41*********************@news.tiscali.it...
Hi to all, I would like to be able to copy & paste a file.
I think the file type in WinXP is the DataFormats.FileDrop. So I have an
object
...
IDataObject myObject = (IDataObject) ido.GetData(DataFormats.FileDrop);
...
but I receive this error:

"An unhandled exception of type 'System.InvalidCastException' occurred in
WindowsApplication1.exe
Additional information: Specified cast is not valid."

Any ideas?

Nov 16 '05 #2

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

Similar topics

8
by: LG | last post by:
Just have a question with regards to the clipboard, and how to read what other applications (Adobe InDesignCS) place in the clipboard. I am currently in the process of creating a booklet from a...
2
by: zbcong | last post by:
hello in my program,i have following method,it copy a jpg file to clipboard,and works well: Private Sub CopyImage() Dim file As System.IO.Stream =...
8
by: John Smith | last post by:
Hi folks, I know how to place text into the user's clipboard: Clipboard.SetDataObject("My Copied Text"); but how do I place a file in there? So, if I have a file C:\test.txt, how can I place...
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...
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...
1
by: Al | last post by:
I'm looking for a sample to save File from clipboard into specified folder on HD. I found many samples for copying text, image etc. But no file copying code so far. Thank you Al
1
by: Ludwig Wittgenstein | last post by:
Hi, all. Here's the scenario: I embedd a .txt file in Word as OLE object, then I copy it (manually), so now it's on the clipboard. How do I programatically (in C#) get that OLE object file from...
5
by: exhuma.twn | last post by:
As many might know, windows allows to copy an image into the clipboard by pressing the "Print Screen" button on the keyboard. Is it possible to paste such an image from the clipboard into a "Text"...
8
by: active | last post by:
Guess I'm looking for someone who likes to work difficult puzzles. I can't seem to ever retrieve a palette handle from the clipboard. Below is a simple test program that demonstrates the...
20
by: Joe Duchtel | last post by:
Hello - I have the following code to get a bitmap from the clipboard and to save it to a *.png file ... Dim lData As IDataObject = Clipboard.GetDataObject() If...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.