Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple read textfile into listview

Status
Not open for further replies.

kalle82

Technical User
Apr 2, 2009
163
SE
Hi!

Im trying to create a really really simple way of reading a textfile into a listview. Almost there but I have a problem...

I ahve looked through on the net and this was the simplest way of reading a textfile into a listview in separate columns.

PRoblem is that when running this code, I ALWAYS run into RUMTIME ERROR 424.. OBJECT NEEDED.. I stepped thorugh the code and it's when I try the, lvwInfo.ListItems.Clear if take aways taht the code stops at: lvwInfo.ListItems.Add

Either it's me or I always find it hard to work with the listview control.. It like it's trying to tell me your not good enough to have me in your programs...

Anyone got a solution?

Thanks!
Code:
Sub readlogfile2(logfilename, page)

Dim filepath As String
    Dim lvItems As ListItem
    Dim date1, loggen As String

    filepath = logfilename & ".ini"

        lvwInfo.ListItems.Clear

Open filepath For Input As #1

    Do While Not EOF(1)
    
Input #1, name1, address1
        
        Set lvItems = lvwInfo.ListItems.Add
        lvItems.Text = date1
        lvItems.SubItems(1) = loggen               
        
    Loop
    
Close #1

End Sub

 
Check listview name if the code is in the userform's module.

combo
 
Ahh that solved i! userform1.listview1

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top