Creating multi-column listview and populating with data from access database
Hi,
I'd like to create a multi-column listview in VB.net to display the results of an ExecuteReader command.
I can get the first column to appear with the correct number of rows but I'm struggling to add the other columns to the view and populate them. I'm probably missing something obvious but a simple step-by-step would be appreciated
Thanks
Visual Basic.NET
Last Comment
Wayne Taylor (webtubbs)
8/22/2022 - Mon
Jorge Paulino
If your problem is just the subitems you can do this way:
Dim item As ListViewItem
' Then on the loop
item = New ListViewItem
item.Text = "First column"
item.SubItems.Add("Second column")
item.SubItems.Add("Third column")
And in the columns you just have to add:
Me.ListView1.Columns.Add("ID", 50, HorizontalAlignment.Left)
Me.ListView1.Columns.Add("Column2", 50, HorizontalAlignment.Left)
Me.ListView1.Columns.Add("Column3", 50, HorizontalAlignment.Left)
Dim item As ListViewItem
' Then on the loop
item = New ListViewItem
item.Text = "First column"
item.SubItems.Add("Second column")
item.SubItems.Add("Third column")
And in the columns you just have to add:
Me.ListView1.Columns.Add("
Me.ListView1.Columns.Add("
Me.ListView1.Columns.Add("