Avatar of Petermcg001
Petermcg001
Flag for United Kingdom of Great Britain and Northern Ireland asked on

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

Avatar of undefined
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)







ASKER CERTIFIED SOLUTION
Wayne Taylor (webtubbs)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23