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

datagridview copy and paste

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
1 5172
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Rich | last post by:
Hello, I am populating a datagridview from a datatable and filtering the number of rows with a dataview object. Is there a way to retrieve the rows displayed by the datagridview into a separate...
3
by: sklett | last post by:
I'm changing from a DataGrid to a DataGridView and have run across a problem. The items that are bound to the DataGrid have an int Property that represents a primary key of a lookup table in my...
0
by: MKBender | last post by:
dear all, I have a dataGridView that has cut,copy, and paste functionality for the cells of the datagrid but now I would like to add the functionality for the user to copy, cut and paste an...
0
by: tom | last post by:
I using VS2005 and trying to use a Context Menu to Copy, Cut & Paste cell data within the DataGridView control and I am finding that this is beyond my limited knowledge. If anybody has a few...
0
by: Chris | last post by:
I have a DataGridView in a form that will display the information from various DataTables in my DataSet. The user is provided a list of tables and when they select a table name, the DataGridView...
2
by: ing.Zeco | last post by:
I need usage possibility when I double click on any row in datagridview, that row must be copied in second datagridview. Any good link about that?!
0
nirmalsingh
by: nirmalsingh | last post by:
hi all, i am using datatable and dataset to assign data into datagridview. now i want to print data of datagridview contents. i used a method to copy datagridview content in a clipboard and to...
0
by: Robert | last post by:
Hi! I want to fill the clipboard programmatically in oder to manual copy the data to word. The data consists of cells of a grid which contains text or images. Using the standard copy/paste of...
2
by: TG | last post by:
Hi! I am trying to export only the visible columns from a datagridview in my windows form in VB 2008. Should't it be no comma after the first row where the headers are? Also should...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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.