Hi,

how to transfer datagridview record to listview?

anyone have an idea?

Re: Transfer Datagridview record to listview VB.NET 80 80

Get the datagridview records into table or dataset and loopthough the recods and add to list view in loop

Re: Transfer Datagridview record to listview VB.NET 80 80

yes, but i don't know how to code it...

here's my code

but all i want is to transfer all record from gridview to listview

Listview1.Enabled = True
        Dim item As New ListViewItem
        Dim i, j As Integer

        With item
            Listview1.Items.Clear()

            i = Listview1.CurrentRow.Index.ToString


            item = lstLicense.Items.Add(DataGridView1.Item(0, i).Value.ToString, 0)
            item.SubItems.Add(DataGridView1.Item(1, i).Value.ToString)
            item.SubItems.Add(DataGridView1.Item(2, i).Value.ToString)
            item.SubItems.Add(DataGridView1.Item(3, i).Value.ToString)
        

        End With
Re: Transfer Datagridview record to listview VB.NET 80 80

Try using the for loop.

for i as integer=0 to DataGridView1.rows.count-1
     ' Add your code which adds records to list  
   Next

Are you using listbox?

Re: Transfer Datagridview record to listview VB.NET 80 80

thanks it works ^_^

Re: Transfer Datagridview record to listview VB.NET 80 80

i have same problem but its not working..because my data gridview is in another form and my listview is in another form..i want if i click button my records in datagrid will be transferd in listview wich is in another for....need some help what is the code for this problem..?Tnx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.