How do I retrieve data from the datagridview line, click the corresponding data to another form

advertisements

i am trying to retrieve data from one form to another form , on gridview click event. I have small code I got it from google search but its giving me error. in this code I was trying to retrieve it to second form datagrid. please check my code. where I am wrong.

Private Sub ReceiveGoods_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For j As Integer = 0 To frmGoodsReceive.dgvPODetails.RowCount - 1
            If frmGoodsReceive.dgvPODetails.Rows(j).Cells(0).Value = True Then
                Dim count As Integer = 0
                For i As Integer = 0 To frmGoodsReceive.dgvPODetails.ColumnCount - 1
                    Me.dgvReceiveGoods.Rows(count).Cells(i).Value = frmGoodsReceive.dgvPODetails.Rows(j).Cells(i).Value
                Next
                count += count
            End If
        Next
    End Sub

I am getting this error, while I run.

Conversion from string "PO003" to type 'Boolean' is not valid.

please help me

what I have the code that totally wrong code I guess. because what I am trying to do is , I have one gridview, and some data on that, when I click the row on datagrid , I want to open the corresponding information to second form gridview. this is the right way to do that?


Try Adding...

Me.dgvReceiveGoods.Rows(count).Cells(i).Value = frmGoodsReceive.dgvPODetails.Rows(j).Cells(i).Value.ToString