Link to home
Start Free TrialLog in
Avatar of IainTheVBALearner
IainTheVBALearner

asked on

Multi column list control – the best choice

Hello

I’ve just started programming in VB.Net in Visual Studio having done lots of VBA.

I’d like to display a multi column list on my form.  I’d like to display files and their attributes:

Filename                             Album          Artist                     Track number
Nine Lives – Crash.mp3       Nine Lives          Aerosmith              3

Which is the best control to do this?

A ListBox appears to be able to store only one field of data – MultiColumn seems to mean displaying a single field of data down then across – with no vertical scroll bars, only horizontal

A ListView seems to be the best option.  I can populate it, but I can’t seem to “get” any values from it.  I can get the selected index number, but not the values.

Any pointers would be appreciated.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of jobrienct
jobrienct

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jobrienct
jobrienct

If you want to use a listview then heres a snippet to get you started reading values:

   For Each row As ListViewItem In myListView.Items
      For Each column As ListViewItem.ListViewSubItem In row.SubItems
         MsgBox(column.Text)
     Next column
  Next row

In this way you can see the relationship between a listview and a coordinate grid or spreadsheet where it can behave as rows and columns and your values are the intersection.

JOhn