|
-
Jul 30th, 2000, 01:22 AM
#1
Thread Starter
New Member
Here is the code for the module for my project (log editor).
I keep getting Invalid Qualifier errors when I try to put values into my array. Please help! lol Thanks
-Pat-
Dim FSys As New FileSystemObject
Dim TMain As TextStream
Dim TSupport As TextStream
Dim LItem As ListItems
Public Type IRec
Index As Long
Edited As Boolean
TheDate As String
TheTime As String
Data As String
End Type
Public DataArray() As IRec
Public NumLines As Long
Dim SingleLine As String
Dim Comma(1 To 4) As Long
Dim FirstCharInLine As Long
Dim DataLength As Long
Dim X As Long
Dim IndexRecord As String
Dim EditedRec As String
Dim DateRecord As String
Dim TimeRecord As String
Dim DataRecord As String
Dim EditedRecord As Boolean
Public Sub NumOfLines()
Set TSupport = FSys.OpenTextFile(frmPref.txtFilePath.Text)
While TSupport.AtEndOfStream = False
TSupport.SkipLine
Wend
NumLines = TSupport.Line
End Sub
Public Sub ParseLog()
ReDim DataArray(1 To NumLines)
FirstCharInLine = 1
X = 1
Set TMain = FSys.OpenTextFile(frmPref.txtFilePath.Text)
'sets up a loop to process each line
While TMain.AtEndOfStream = False
SingleLine = TMain.ReadLine
'sets up a loop to find all 4 comma delims
For i = 1 To 4
Comma(i) = InStr(FirstCharInLine, SingleLine, ",")
FirstCharInLine = FirstCharInLine + 1
Next i
'I'm going to process each record with it's own code
'Extracting each record from the string so I can do my work
IndexRecord = Mid(SingleLine, 1, Comma(1) - 1)
EditedRec = Mid(SingleLine, Comma(1) + 1, Comma(2) - 1)
DateRecord = Mid(SingleLine, Comma(2) + 1, Comma(3) - 1)
TimeRecord = Mid(SingleLine, Comma(3) + 1, Comma(4) - 1)
DataRecord = Mid(SingleLine, Comma(4) + 1)
'...on the Index value...No need?
'IndexRecord = CLng(IndexRecord)
'...on the Edited value
If EditedRec = "Yes" Then
EditedRecord = True
ElseIf EditedRec = "No" Then
EditedRecord = False
End If
'...on the Date value...No need?
'DateRecord = CDate(DateRecord)
'...on the Time value...No need?
'TimeRecord = CDate(TimeRecord)
'...on the Data value
DataLength = Len(DataRecord)
DataRecord = Mid(DataRecord, 2, DataLength - 1)
'Inputing these into the array
DataArray.Index(X) = IndexRecord 'err...
DataArray.Edited(X) = EditedRecord 'err...
DataArray.TheDate(X) = DateRecord 'err...
DataArray.TheTime(X) = TimeRecord 'err...
DataArray.Data(X) = DataRecord 'err...
'set it up for the next loop cycle
X = X + 1
Wend
End Sub
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
|