datagridview copy to clipboard exceptions

I am trying to copy a fairly large amount of data (~ 50,000 rows, 200 columns of doubles) from a datagridview to the clipboard. To do this I'm selecting all cells and pressing Ctrl+C, at which point I think datagridview handles the actually clipboard copying internally. The program pauses for several seconds then displays the cryptic message...

"Argument 'Prompt' cannot be converted to type 'String'."

... then the program quits.

I have copied from datagridview to clipboard tons of times in the past, but never this many cells. Regardless, I don't believe this is an inordinate amount of data for today's computers.

This is part of debugging a larger issue, where I'd written a routine that copies an entire datagridview to clipboard, opens a new Excel workbook, and dumps to Excel. If I run that routine for this particular datagridview, I get a System.OutofMemory exception.


Maybe I was too quick to say 50K rows + 200 columns was a manageable amount for the clipboard. That judgment partly came from the ability copy & paste similar amounts in Excel, but after further examination I'm not sure exactly if/when/how Excel makes use of the clipboard. So maybe I am exceeding reasonable memory demands... I've switched to a piecemeal approach.

链接地址: http://www.djcxy.com/p/62254.html

上一篇: c#DataGridView EditMode和DeleteKey

下一篇: datagridview复制到剪贴板异常