Results 1 to 3 of 3

Thread: Help with LISTVIEW control...

  1. #1

    Thread Starter
    Lively Member bgalm's Avatar
    Join Date
    Jan 1999
    Posts
    65

    Question

    Hello,
    Below is a snippet of code I am using to fill up a LISTBOX with text from a file.

    If Len(Dir(App.Path & "\TEST.LST")) <> 0 Then
    Open App.Path & "\TEST.LST" For Input As #iFileNum
    Do While Not EOF(iFileNum)
    Line Input #iFileNum, STemp
    List1.AddItem STemp
    If Right$(STemp, 1) = "1" Then
    List1.Selected(List1.NewIndex) = True
    Else
    List1.Selected(List1.NewIndex) = False
    End If
    Loop
    Close #iFileNum
    End If

    I would like to "convert" this code to work with a LISTVIEW instead of a LISTBOX. Can this be done ?
    Thanks,

  2. #2
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    Code:
    Dim liEntry As ListItem
    If Len(Dir(App.Path & "\TEST.LST")) <> 0 Then 
        Open App.Path & "\TEST.LST" For Input As #iFileNum 
        Do While Not EOF(iFileNum) 
            Line Input #iFileNum, STemp 
            Set liEntry = ListView1.ListItems.Add(, , STemp)
            liEntry.Selected = IIf(Right$(STemp, 1) = "1", True, False)
        Loop 
        Close #iFileNum 
    End If
    "It's cold gin time again ..."

    Check out my website here.

  3. #3

    Thread Starter
    Lively Member bgalm's Avatar
    Join Date
    Jan 1999
    Posts
    65

    Smile Thanks...

    ...everything is working great, I just need to tweak the display of the items a little now.

    Thanks again,

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