Results 1 to 4 of 4

Thread: [RESOLVED] Make new items in Listview bold

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2005
    Posts
    1,834

    Resolved [RESOLVED] Make new items in Listview bold

    Hi, I have a problem with checking a Listview for new items. I think it should be quite easy, but I can't figure it out.

    The data in my Listview gets updated from an online XML file (RSS feed). After the data has been added to the Listview, all items are added to a Collection as well.

    When the data is updated again, I want to loop through the Listview items and check if an item also exists in the Collection (which consists of data from the previous update). If the Listview item cannot be found in the Collection it means it's new data and I want to make it bold.

    I can't simply count Listview items, because most of the time the updated data is partially the same.

    vb Code:
    1. If cItems.Count <> 0 Then
    2.         For i = 1 To lvwXML.ListItems.Count 'Loop through Listview
    3.         tmp = lvwXML.ListItems(i).Text 'Put item in a variable
    4.             For y = 1 To cItems.Count 'Loop through the Collection
    5.                
    6.                 '// If Listview item is not in the Collection it's new data
    7.                 If tmp ????? Then
    8.                     lvwXML.ListItems(i).Bold = True
    9.                 End If
    10.                
    11.                
    12.             Next y
    13.         Next i
    14. End If
    15.  
    16. Set cItems = Nothing
    17. Set cItems = New Collection
    18.  
    19. For i = 1 To lvwXML.ListItems.Count
    20.     cItems.Add lvwXML.ListItems(i).Text 'Store current Listview data in Collection again to use with the next update
    21. Next i

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Make new items in Listview bold

    dont "recheck"
    where are you adding the items to the listview?
    when you add it.. its a new item.. make it bold then
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2005
    Posts
    1,834

    Re: Make new items in Listview bold

    ::Edit::

    Nevermind, I found the problem.
    There was something wrong with adding the data.
    Last edited by Chris001; Nov 5th, 2007 at 02:04 PM.

  4. #4
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: [RESOLVED] Make new items in Listview bold

    ok, im rusty with collections... but what if you compare

    If tmpSubject = CStr(cItems(i)) Then

    to make sure its a string to string compare?
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

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