Results 1 to 3 of 3

Thread: <?> Listview Icon View

  1. #1

    Thread Starter
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946
    Code:
    'question:
    'I load my listview and I use 2 different icons
    'one for odd numbers, one for even. No Problem
    '
    I can then view my listview by LargeIcon,SmallIcon,List,Report
    No Problem
    However, when viewing largeicon I only get one icon
    All the rest show me the 2 different icons.
    
    There obviously is a reason...someone what to impart
    that bit of knowledge on me.
    
    'load an array with information
    Dim myArr(99)
    Dim i As Integer
    For i = 1 To 99
        myArr(i) = CInt(Rnd * 99)
    Next i
    
    'then load the array into a listview
    
    Dim x As Variant  'differ between odd and even rows
    
    For i = 1 To 99
        'used different images every second line
        'image one for odd, image2 for even
        x = i / 2
        If x Like "*.*" Then
        Set sItem = Listview1.ListItems.Add(, , myArr(i), 1, 1)
        Else
        Set sItem = Listview1.ListItems.Add(, , myArr(i), 1, 2)
        End If
        'add subitems
        sItem.SubItems(1) = "905-444-9455"
        sItem.SubItems(2) = "who knows"
    Next i
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  2. #2
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    I think you are going to kick yourself.

    This line is the problem
    Code:
    'you have 1 as the image for the nromal icon
    Set sItem = Listview1.ListItems.Add(, , myArr(i), 1, 2)
    
    'it should be 2
    Set sItem = Listview1.ListItems.Add(, , myArr(i), 2, 2)
    I would also suggest you use the MOD operator to determine odd / even numbers
    Code:
    If i Mod 2 <> 0 Then
      Set sItem = ListView1.ListItems.Add(, , myArr(i), 1, 1)
    Else
      Set sItem = ListView1.ListItems.Add(, , myArr(i), 2, 2)
    End If
    Iain, thats with an i by the way!

  3. #3

    Thread Starter
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    KICK KICK
    one for the line, one for mod
    I knew there was an operator I just didn't know which one
    and I was too embarassed to ask and then I go and paste my code...make that KICK KICK KICK

    Thanks,
    Later
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

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