Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Help] - ListView Control
#1
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?
#2
Anybody help me out with this? It's doing my head in.
#3
Never mind, got it working in the end.


Possibly Related Threads…
Thread Author Replies Views Last Post
  [VB.NET] Advanced MessageBox Control BlackSpider 14 12,242 03-04-2015, 11:22 PM
Last Post: longwest
  vb6.0 SSTab control disappeared DanB 0 1,308 12-29-2012, 10:24 AM
Last Post: DanB
  [Source] Tricks Using PictureBox Control [VB.NET] Fragma 8 6,532 11-25-2012, 10:32 PM
Last Post: ƃu∀ ıʞƃu∀
  [SOURCE] VTSkid-Control [Release] FizzyMentos 14 4,165 09-11-2012, 08:18 PM
Last Post: malis2007
  [NEED HELP] how to read a text file and import to listview vb.net w00pz 7 6,508 02-13-2012, 06:42 AM
Last Post: AceInfinity

Forum Jump:


Users browsing this thread: 1 Guest(s)