Results 1 to 3 of 3

Thread: Another question about LISTVIEW...

  1. #1

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

    Question

    Hello again,
    Many thanks for the help before with LISTVIEW. Below is the code that reads in a text file and populates it into a LISTVIEW. The text file is setup like 1,2,3,4,5,6,7. What I am trying to do is read in the value of 1 and put it in the first column, 2 for second, etc. I can easily captures the values of 1,2,3,etc. but cannot get them to display in the columns, matter of fact, I can't get any columns to display.

    If Len(Dir(App.Path & "\GAME.LST")) <> 0 Then
    Open App.Path & "\GAME.LST" For Input As #iFileNum
    GameTotal = 0

    Do While Not EOF(iFileNum)
    Line Input #iFileNum, STemp
    Set liEntry = ListView1.ListItems.Add(, , STemp)
    mystring = STemp
    mypos1 = InStr(1, mystring, ",")
    mypos2 = InStr(mypos1 + 1, mystring, ",")
    mypos3 = InStr(mypos2 + 1, mystring, ",")
    mypos4 = InStr(mypos3 + 1, mystring, ",")
    mypos5 = InStr(mypos4 + 1, mystring, ",")
    mypos6 = InStr(mypos5 + 1, mystring, ",")
    mypos7 = InStr(mypos6 + 1, mystring, ",")
    s1 = Left(mystring, mypos1 - 1)
    s2 = Mid(mystring, mypos1 + 1, mypos2 - mypos1 - 1)
    s3 = Mid(mystring, mypos2 + 1, mypos3 - mypos2 - 1)
    s4 = Mid(mystring, mypos3 + 1, mypos4 - mypos3 - 1)
    s5 = Mid(mystring, mypos4 + 1, mypos5 - mypos4 - 1)
    s6 = Mid(mystring, mypos5 + 1, mypos6 - mypos5 - 1)
    s7 = Right(mystring, Len(mystring) - mypos6)

    If Len(Dir(MRP & "\" & s2 & ".ZIP")) <> 0 Then
    liEntry.Checked = True
    GameTotal = GameTotal + 1
    Else
    liEntry.Checked = False
    End If
    Loop
    Close #iFileNum
    End If

    Thanks,

  2. #2
    Guest
    Code:
    Dim liEntry As MSComctlLib.ListItem, s() As String
    If Len(Dir(App.Path & "\GAME.LST")) <> 0 Then
    Open App.Path & "\GAME.LST" For Input As #1
    GameTotal = 0
    Do While Not EOF(iFileNum)
    Line Input #iFileNum, STemp
    Set liEntry = ListView1.ListItems.Add(, , "Morning", 0, 0)
    mystring = STemp
    
    'mypos1 = InStr(1, mystring, ",")
    'mypos2 = InStr(mypos1 + 1, mystring, ",")
    'mypos3 = InStr(mypos2 + 1, mystring, ",")
    'mypos4 = InStr(mypos3 + 1, mystring, ",")
    'mypos5 = InStr(mypos4 + 1, mystring, ",")
    'mypos6 = InStr(mypos5 + 1, mystring, ",")
    'mypos7 = InStr(mypos6 + 1, mystring, ",")
    's1 = Left(mystring, mypos1 - 1)
    's2 = Mid(mystring, mypos1 + 1, mypos2 - mypos1 - 1)
    's3 = Mid(mystring, mypos2 + 1, mypos3 - mypos2 - 1)
    's4 = Mid(mystring, mypos3 + 1, mypos4 - mypos3 - 1)
    's5 = Mid(mystring, mypos4 + 1, mypos5 - mypos4 - 1)
    's6 = Mid(mystring, mypos5 + 1, mypos6 - mypos5 - 1)
    's7 = Right(mystring, Len(mystring) - mypos6)
    s() = Split(mystring, ",") 
    'Added--------------------
    liEntry.SubItems(1) = s(1)
    liEntry.SubItems(2) = s(2)
    liEntry.SubItems(3) = s(3)
    liEntry.SubItems(4) = s(4)
    liEntry.SubItems(5) = s(5)
    liEntry.SubItems(6) = s(6)
    liEntry.SubItems(7) = s(7)
    'End Added----------------
    
    If Len(Dir(MRP & "\" & s2 & ".ZIP")) <> 0 Then
    liEntry.Checked = True
    GameTotal = GameTotal + 1
    Else
    liEntry.Checked = False
    End If
    Loop
    Close #1
    End If
    Enjoy Ex!

  3. #3

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

    Thumbs up Thanks...

    ...it works great, the app never looked better
    Thanks for taking time out to help,

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