|
-
Jun 19th, 2001, 11:33 PM
#1
Thread Starter
Addicted Member
Reading from file to listview...
Public Sub ReadWebLog()
Dim intFNum As Integer
Dim strRData As String
Dim lstItem As ListItem
Dim tdDate As Date
Dim tdTime As Date
Dim strWebsite As String
Dim blnBlocked As Boolean
intFNum = FreeFile
Open (App.Path & "\WebLog.dat") For Input As #intFNum
Do Until EOF(intFNum)
Input #intFNum, tdDate, tdTime, strWebsite, blnBlocked
Set lstitm = frmWebsiteLog.lstvWebLog.Add(, , tdDate)
lstitm.ListSubLists(1).Text = tdTime
lstitm.ListSubLists(2).Text = strWebsite
lstitm.ListSubLists(3).Text = blnBlocked
Loop
Close #intFNum
End Sub
This code does not read from a comma-delimited file. I want to read this data into a listview control. It tells me .Add is not a method or anything, I don't know how to add this data to a litview contro. Can anyone help?!
-
Jun 20th, 2001, 02:28 AM
#2
Hyperactive Member
Hi there,
This is the edited code for your app, i 've tested it and it works fine.
Public Sub ReadWebLog()
Dim intFNum As Integer
Dim strRData As String
Dim lstItem As ListItem
Dim tdDate As Date
Dim tdTime As Date
Dim strWebsite As String
Dim blnBlocked As Boolean
Dim i As Long
intFNum = FreeFile
Open (App.Path & "\WebLog.dat") For Input As #intFNum
Do Until EOF(intFNum)
Input #intFNum, tdDate, tdTime, strWebsite, blnBlocked
i = i + 1
Set lstItem = Me.lstvWebLog.ListItems.Add(, , tdDate)
Me.lstvWebLog.ListItems.Item(i).SubItems(1) = tdTime
Me.lstvWebLog.ListItems.Item(i).SubItems(2) = strWebsite
Me.lstvWebLog.ListItems.Item(i).SubItems(3) = blnBlocked
Loop
Close #intFNum
End Sub
On your form there must be a listview with four columns and the view property must be set on 'lvwReport'
If you have problems executing this code, please let me know, then I ll send you the VB project.
Kind regards, Luc
-
Jun 20th, 2001, 08:46 AM
#3
Thread Starter
Addicted Member
Thanks much, I'll try that when I get home.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|