Click here to Skip to main content
11,484,941 members (77,921 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
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 4:10am
Remoddn1.1K
Comments
CHill60 at 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
good
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)
    dt_source.Rows.Remove(row);
 
// Then you databind the destination datagridview to the destination datatable (dt_destination).
  Permalink  
Comments
Remoddn at 13-Feb-13 3:32am
   
Thanks Victor! Today I found solution myself and posted with new question and answer
Victor Rene at 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
0 Sergey Alexandrovich Kryukov 330
1 Maciej Los 280
2 Raje_ 155
3 Mehdi Gholam 150
4 OriginalGriff 133
0 Sergey Alexandrovich Kryukov 8,494
1 OriginalGriff 7,948
2 Sascha Lefèvre 3,199
3 Maciej Los 2,681
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 8 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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