By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,166 Members | 1,130 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,166 IT Pros & Developers. It's quick & easy.

datagridview copy and paste

P: n/a
Hi everyone,
I found resources on the web to do a copy on a datagridview control but i
havent found any on pasting back to the control. I m trying to figure out
how to do a shallow copy on a datagrid row.
if (c is DataGridView)

{

DataGridView d = (DataGridView)c;

Clipboard.SetDataObject(d.GetClipboardContent());

}
Can someone please point me out to resources on how to paste cells copied
this way into the datagrid. Links or pointers will be appreciated.

- idatarm
Aug 1 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
The Tarm,

Doing so would be very difficult. You would have to basically figure
out when you want the paste operation to occur, and then parse the
information from the clipboard into a two-dimensional array of values. Once
you have that, you would have to traverse the cells and paste the values
into the cells.

You might want to consider overriding the GetClipboardContent and
placing the information on the clipboard which is easier to figure out the
values of, as right now, you are getting a comma delimited file, html, and
text.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"The Tarm"
<Pl*********************************************** *****@yahoo.comwrote in
message news:uy**************@TK2MSFTNGP03.phx.gbl...
Hi everyone,
I found resources on the web to do a copy on a datagridview control but i
havent found any on pasting back to the control. I m trying to figure out
how to do a shallow copy on a datagrid row.
if (c is DataGridView)

{

DataGridView d = (DataGridView)c;

Clipboard.SetDataObject(d.GetClipboardContent());

}
Can someone please point me out to resources on how to paste cells copied
this way into the datagrid. Links or pointers will be appreciated.

- idatarm
Aug 2 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.