• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 548
  • Last Modified:

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
0
IainTheVBALearner
Asked:
IainTheVBALearner
  • 2
1 Solution
 
jobrienctCommented:
Datagrid would probably be most appropriate for this.

heres a tutorial, have a look.

http://www.codeproject.com/vb/net/grid101.asp

John
0
 
jobrienctCommented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now