Multi column list control – the best choice

Posted on 2006-04-17
Last Modified: 2007-12-19

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.

Question by:IainTheVBALearner
    LVL 10

    Accepted Solution

    Datagrid would probably be most appropriate for this.

    heres a tutorial, have a look.

    LVL 10

    Expert Comment

    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
         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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Suggested Solutions

    Title # Comments Views Activity 2008 2 39
    Disable & as shortcut in label 3 26
    vb linq Count Distinct? 1 29
    Better way of writing the code 4 22
    Article by: jpaulino
    XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
    Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now