andy38 0 Newbie Poster

H1, Using VB Net (2005, Access (2003) in Windows Forms., After many hour of searching and readind on the net I came to the conclusion that I have to use a dataGrigView instead of a listWiew , so I shift the listView further down below on m y form to make room for the dataGridView (“DgvItems”). As I double click in my first dataGrigView to extract data and it does and also as you can see in my code it does add a new row to the DgvItems but no data it is empty, how can I change the code so it fill the dataGridView instead of the listWiew , been trying all yesterday and today don’t get anywhere, hope someone can help me. Thank you in advance.

Private Sub DgProducts_CellContentDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DgProducts.CellContentDoubleClick
' Declare a variable named chosenProductsRow of type ProductsRow.ownerRow
Dim chosenProductsRow As ProductsDataSet.ProductsRow
' Retrieve the ProductsRow object from the DataGridView row;
' assign it to the chosenProductsRow variable.
chosenProductsRow = CType(CType(Me.BindingSource1.Current, DataRowView).Row, ProductsDataSet.ProductsRow)
' Use data from the double-clicked row.
Dim dr As DataRow = chosenProductsRow
'Create the ListViewItem
Dim lvi As New ListViewItem
Dim o As Object
For Each o In dr.ItemArray
lvi.SubItems.Add(o.ToString())
Next
ListView1.Items.Add(lvi)
' If necessary
ListView1.View = View.Details

Me.DgvItems.Rows.Add()

Be a part of the DaniWeb community

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