Also, i now opted for an option to it.. I also tried using two datagridviews in one form for the same purpose..
1st is dgv1, which is bound to data source, and contains checkbox column..
When the user checks in the box, the selected rows should be displayed in the dgv3 on the same form, on click of the button..
I tried to debug and what I could conclude was that the rows with checkbox are read but there is a difficulty in fetching the data and displaying it in the other grid..
The code I use is :
Private Sub Btn_Transfer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Transfer.Click
Dim IsRowSelected As Boolean
Dim SelectedValue As String
Dim i As Integer
'For Each row As DataGridViewRow In dgv1.Rows
'Dim chk As DataGridViewCheckBoxCell = TryCast(row.Cells(0), DataGridViewCheckBoxCell)
For i = 0 To Me.dgv1.RowCount - 1
IsRowSelected = Me.dgv1.Rows(i).Cells(0).Value
If IsRowSelected = True Then
SelectedValue = Me.dgv1.Rows(i).Cells(0).Value
.Rows(.RowCount - 1).Cells(0).Value = SelectedValue
'If Convert.ToBoolean(chk.Value) = True Then
Here, the problem seems to be somewhere in
[code]SelectedValue = Me.dgv1.Rows(i).Cells(0).Value[/code]
as this evaluates to the value "Nothing"..
I am also attaching the output I m obtaining.. Download source fileRuchi22, if this helps please login to Mark As Answer. | Alert Moderator