|
-
February 22nd, 2010, 09:32 AM
#7
Re: ABOUT STRING READING FROM textfile
I think I know, what you want. You want to store the additional info t an Alarm somewhere.
Why not use a collection. You declare a collection for the additional data and then you load like this:
Code:
Private Dim MoreData as Collection
Private Sub LoadFile(FileName As String)
dim a$, b$, c$
List1.Clear
Set MoreData = New Collection
Open FileName For Input As #1
While Not EOF(1)
Line Input #1, a$
If InStr(a$, "ALARM=") Then
List1.AddItem Trim(Mid$(a$, 7))
Line Input #1, a$: b$=Trim(Mid$(a$,6))
Line Input #1, a$: c$=Trim(mid$(a$,13))
MoreData.Add b$ + "/" + c$
End If
Wend
Close #1
End Sub
when an ALARM line is encountered, the Alarm is added to the listbox.
Then 2 more lines are read in, the values concatenated with "/" and added to the collection.
You have to watch out when retrieving the data, though. ListBox elements start with 0, Collections start with 1.
That is, List1.Listitem(0) will contain "ALARM1", but the according data is in
MoreData(1), which is "ZONE6/NEED TO REPLACE"
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
|