Click here to Skip to main content
11,581,353 members (57,844 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VB.NET
I made a programmed to Transfer Employee's To Other Company Therefore I used Two DataGridView, In First DataGridView Component I Bind it with database and Add One Another columns, and it's a checkboxcolumn,
Now I want to Copy/Transfer Rows From One DataGridView1 To DataGridView2 When I Tick or Checked; ChecekColumnBox in First DataGridView1.
Posted 12-Feb-13 20:54pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I got It........
I made New and success in datagridview1 rows copy to another datagridview2 in

below is a code on button12_click Event

Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
        Dim c, t As Integer
        For t = 0 To dg1.Columns.Count - 1
        For c = 0 To dg1.Rows.Count - 1
     If dg1.Rows(c).Cells(4).Value = True Then
                dg2.Rows.Add(dg1.Rows(c).Cells(0).Value, dg1.Rows(c).Cells(1).Value)
                dg2.Columns(2).Visible = False
                dg2.Columns(3).Visible = False
     End If
    End Sub
Use it..............

[edit]code blocks added[/edit]
Nelek at 13-Feb-13 3:10am
Self-solved in the same minute of the question.... that was fast :)
Remoddn at 13-Feb-13 3:29am
Yes! Nelek Because of I m trying or finding this question's answer but unable to find therefore today I create and find solution so; I post both of them, i.e. question's with answer.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Dim c, t As Integer
     For t = 0 To DataGridView1.Columns.Count - 1
     For c = 0 To DataGridView1.Rows.Count - 1
         If Not IsDBNull(DataGridView1.Rows(c).Cells(3).Value) Then
             DataGridView2.Rows.Add(DataGridView1.Rows(c).Cells(0).Value, DataGridView1.Rows(c).Cells(1).Value, DataGridView1.Rows(c).Cells(2).Value, DataGridView1.Rows(c).Cells(3).Value)
             ' DataGridView2.Columns(2).Visible = False
             ' DataGridView2.Columns(3).Visible = False

         End If

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

  Print Answers RSS
0 OriginalGriff 260
1 Sergey Alexandrovich Kryukov 155
2 virusstorm 114
3 Frankie-C 105
4 RyanDev 84
0 OriginalGriff 1,183
1 Sergey Alexandrovich Kryukov 825
2 Abhinav S 597
3 F-ES Sitecore 500
4 Suvendu Shekhar Giri 433

Advertise | Privacy | Mobile
Web03 | 2.8.150603.1 | Last Updated 19 Aug 2014
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