Click here to Skip to main content
13,593,743 members
Rate this:
Please Sign up or sign in to 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
Posted 8-Feb-13 3:10am
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

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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).
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web03 | 2.8.180618.1 | Last Updated 8 Feb 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100