weeurey weeurey - 6 months ago 4x
Vb.net Question

How exactly do I create a multicolumn listbox in Visual Basic?

What I'm looking for is a list box that has multiple columns for example a list box for books where each row would have a title, price, author.

Bonus points for anyone who can give me some pointers on how exactly I can add items to the list aswell. Im guessing

listBox1.Items.Add("Harry Potter", "JK Rowling", 5.99);

wont work?


I've run into the same question before and turned to ListViews instead. Something like:

Public Class Form1
Public Sub New()

    ' This call is required by the designer.

    ' Add any initialization after the InitializeComponent() call.
    Dim lv As New ListView
    With lv
        .View = View.Details
        .FullRowSelect = True
    End With

    lv.Dock = DockStyle.Fill

    lv.Items.Add(New ListViewItem({"Harry Potter", "J.K. Rowling", 5.99}))
End Sub
End Class