473,385 Members | 2,005 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,385 software developers and data experts.

Copy from datagridview and paste to second datagridview

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?!
Oct 29 '07 #1
2 13625

private void dataGridView1_CellClick(object sender,
DataGridViewCellEventArgs e)
{

}

in cellclick event of firdt datagrid u need to right code to add add the
selected rows to secod datagridview.

"ing.Zeco" wrote:
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?!
Oct 29 '07 #2
private void Form1_Load(object sender, EventArgs e)
{
foreach(DataGridViewColumn c1 in dataGridView1.Columns)
{
DataGridViewColumn c2 = (DataGridViewColumn)c1.Clone();

dataGridView2.Columns.Add(c2);
}
}
private void dataGridView1_CellContentClick(object sender,
DataGridViewCellEventArgs e)
{
DataGridViewRow r2 =
(DataGridViewRow)dataGridView2.Rows[0].Clone();
int i=0;
foreach( DataGridViewCell cell in
dataGridView1.Rows[e.RowIndex].Cells)
{
r2.Cells[i].Value = cell.Value;
i++;
}
dataGridView2.Rows.Add(r2);
dataGridView2.Refresh();
}

try thsi one first oin pageload add columns from first too secord datagrid
and then

in CellContentClick event add row from first to secord datagridview.
"ing.Zeco" wrote:
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?!
Oct 29 '07 #3

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

Similar topics

5
by: kirschpe | last post by:
I developed an application using visual studio 2003. Now I want to make a similar application without having to redesign similar forms. Is there a way to copy and paste windows forms across...
0
by: Pieter Coucke | last post by:
Hi, I have a DataGridView, that contains a list of Articles, which can be added (automaticly via the AllowUserToAddRows) and changed by the user. The current item is also displayed in textboxes...
5
by: Kaur | last post by:
Hi, I have been successful copying a vba code from one of your posts on how to copy and paste a record by declaring the desired fields that needs to be copied in form's declaration and creating two...
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...
1
by: The Tarm | last post by:
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...
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...
5
by: phill86 | last post by:
Hi I have a main form that holds records for scheduled meetings, date time location etc... in that form i have a sub form that has a list of equipment resources that you can assign to the meeting in...
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: 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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.