Support Forums

Full Version: [Help] - ListView Control
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to add items to a ListView control.
I have 2 columns, the second, entitled "Name" being the main column, which will display the name of the file added, and the first showing the number of the item.

iTunes is a good example of what I'm after, only without the checkboxes:
[Image: itunes.png]

I'm a newbie when it comes to using the ListView control and I'm finding it a total nightmare. Here's my code so far:

Code:
Dim item As New ListViewItem()
            Dim i As Integer = lst1.Items.Count
            lst1.Items.Add(item)
            item.Text = i + 1

            Dim l As Integer = item.SubItems.Count
            item.SubItems.Add(OFD.FileName)
            lst1.Items(0).SubItems(l - 1).Text = OFD.FileName

Which for some reason, when adding the first item, instead of displaying "1", it displays the OFD.FileName, however when I add the second item, it works and displays the number "2".

[Image: swfapp.png]

Any help with this?
Anybody help me out with this? It's doing my head in.
Never mind, got it working in the end.