Click here to Skip to main content
15,902,112 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello! I m making a program to transfer employee's into other branch, therefore I get two datagridview, first for data binding and all employee's list from database, I make my firsdatagridview last coloumns for checkboxcolumns.
I want to that When I m clicking on button transfer then checked rows will be transfer into another or second datagridview, But I m unable to developed this, yes I search more n more time code for this process, but failed. can anyone help me about this problems..

Thanks In Advance
CHill60 8-Feb-13 9:33am    
If you type datagrid copy rows into the search box at the top right of this window you will get several answers on how to do this. If you type "vb net datagridview copy rows to another datagridview" into google you will get 200+ results

1 solution

using System.Collections.Generic;
using System.Data;
using System.Linq; 

//DataTable dt_source;
//DataTable dt_destination;

// Selects the rows
var selectedRows = from DataRow r in dt_source.Rows
                   where r["mustTransfer"].Equals(true)
                   select r;

// Copy the rows
dt_destination = selectedRows.CopyToDataTable();

// Remove old rows
foreach(DataRow row in selectedRows)

// Then you databind the destination datagridview to the destination datatable (dt_destination).
Share this answer
Remoddn 13-Feb-13 3:32am    
Thanks Victor! Today I found solution myself and posted with new question and answer
Victor Rene 14-Feb-13 4:53am    
I'm happy to know that was helpful.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900