Results 1 to 10 of 10

Thread: ListView Subitems

  1. #1

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Resolved ListView Subitems

    In other apps where I've used the ListView i've added things like this.

    VB Code:
    1. Dim itmX as ListView
    2.  
    3. Set itmX = ListView1.ListItems.Add
    4. itmX = Item1
    5. itmX.SubItems(1) = Item2
    6. itmX.SubItems(2) = Item3
    7. 'etc....

    However in a new app i've set everything up the same but when I try to complie to EXE i get a message saying "Method or data member not found" and the below code is highlighted. I can't figure out why it's not working
    VB Code:
    1. .SubItems(1)
    Last edited by lintz; Oct 8th, 2005 at 06:36 PM.

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: ListView Subitems

    VB Code:
    1. ListView1.ListItems.Add , , "Some text"
    2. ListView1.ListItems.Item(ListView1.ListItems.Count).ListSubItems.Add , , "Subitem 1 text"
    3. ListView1.ListItems.Item(ListView1.ListItems.Count).ListSubItems.Add , , "Subitem 2 text"
    4. ListView1.ListItems.Item(ListView1.ListItems.Count).ListSubItems.Add , , "Subitem 3 text"

  3. #3

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: ListView Subitems

    Thanks baja_yu, but can you explain why my code won't work "this time"?

  4. #4

  5. #5

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: ListView Subitems

    Thanks Rhino, that was my problem.....a little early on a Sunday to be coding

  6. #6

  7. #7
    New Member gdcats's Avatar
    Join Date
    Sep 2007
    Location
    Dubai UAE
    Posts
    5

    Re: ListView Subitems

    Hi i have a problem populating the Listview in VB.net, it doesn;t actually display the rows from a table (like it does in VB6)

    vb Code:
    1. Dim da As New System.Data.OleDb.OleDbDataAdapter()
    2.         Dim ds As New DataSet()
    3.         da.Fill(ds, rstTemp, "customers")
    4.         '
    5.         Dim iTM As ListViewItem
    6.         For i = 0 To ds.Tables(0).Rows.Count - 1
    7.             iTM = ListView1.Items.Add(ds.Tables(0).Rows(i).Item(0))
    8.             iTM.SubItems(1) = ds.Tables(0).Rows(i).Item(1)
    9.         Next

    the customers table contains fields, CUSTNO, LNAME, FNAME but when you run the above code it doesn't show the proper listing of rows from customers table, a little help would be appreciated. Thanks.

  8. #8
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: ListView Subitems

    Holy Moly, 14,465 views and only 7 replies.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  9. #9
    Frenzied Member
    Join Date
    Nov 2005
    Posts
    1,834

    Re: ListView Subitems

    jmsrickland, this thread is 6,5 years old


    @gdcats, you should start your own thread in the VB.NET forum instead of digging up a 6,5 year old thread in the VB6 forum.

  10. #10
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: ListView Subitems

    Maybe that explains why so many views. I hardly ever look at the date of the Thread. If I see it in the Forum I go into it without any care whatsoever as to it's age


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width