Start New Discussion within our Software Development Community

I have 2 forms , form one has a datagrid with 10 columns
form 2 has a listview box with 4 columns
i want to populate the listview columns with 4 of the values from a row in the datagrid when the row is selected and the 'add ' button selected.
i am fairly new to this so trying to get more understanding.
How do i specify which cell goes to which column in the listview?
how do i specify which columns values i want to send to the listview?
i am sending value from "FORM A to FORM B"
datagrid has columns "A to j"
listview has columns "k to N"
an attempt of my code is pasted
any help would be appreciated

Private Sub btnadd_Click(sender As Object, e As EventArgs) Handles btnadd.Click


        If ProductDataGridView.SelectedCells.Count >= 0 Then

            For Each row As DataGridViewRow In ProductDataGridView.SelectedRows

                frm_A.ListView1.Items.Add(row.Cells(B).Value.ToString())
                frm_A.ListView1.Items.Add(row.Cells(D).Value.ToString())
                frm_A.ListView1.Items.Add(row.Cells(F).Value.ToString())
                frm_A.ListView1.Items.Add(row.Cells(G).Value.ToString())

            Next

        Else

            MsgBox("Warning!", MsgBoxStyle.Exclamation, "NOT SELECTED")

        End If



    End Sub

i have managed to transfer data from the datagrid to listview,but at the moment all 4 values are dropping into the first column of the listview.
how do i specify which column to go to.

This question has already been answered. Start a new discussion instead.