I'm trying to create a ListView through code and add rows from a dataset to it. The code builds and runs but doesn't display a ListView on the form. It is getting data as I've walked it through and seen the ListViewItems getting added. Here is my code. Anyone have a suggestion
Thank you
dsItems.Clear()
ItemsTableAdapter.Fill(dsItems.Items)
Dim dtable As DataTable = dsItems.Tables("Items") Dim ListView1 As New ListViewListView1.Columns.Add(
"ItemDate", -1, HorizontalAlignment.Center)ListView1.Columns.Add(
"ItemText", -1, HorizontalAlignment.Left)ListView1.Items.Clear()
Dim i As Integer For i = 0 To dtable.Rows.Count - 1 Dim drow As DataRow = dtable.Rows(i) Dim lvi As ListViewItem = New ListViewItem(drow("ItemDate").ToString)lvi.SubItems.Add(drow(
"ItemText").ToString)ListView1.Items.Add(lvi)
Next
ListView doesn't show on form
Michael Sabbag
WmS
hi,
you forgot to add the control to the form controls you can add this line after you creat the list view
Me.Controls.Add(ListView1)hope it was helpfull
Leo kaplin