-
Greetings,
Here is a realy easy and stupid question :)
I wonder how I can open a text file and then search it for a string and then display the info after string but only to the end of line.
like this:
FileInfo=File made by: blahblah blah..
<html>
<body background="/images/bground.gif" bgcolor="#ffffff" text="#000000" marginheight="0" topmargin="0">
...
I want to be able to display the "File made by (and so on)"
and also be able to not display the data on the next lines (the <html> and <body background="/images/bground.gif" bgcolor="#ffffff" text="#000000" marginheight="0" topmargin="0"> tags).
Thanks in advance.
-Lumin
-
Code:
Option Explicit
Dim FileNumber As Integer
Dim TextLine As String
Private Sub Command1_Click()
FileNumber = FreeFile()
Open "C:\Myfile.txt" For Input As FileNumber
Do While Not EOF(FileNumber)
'read line here
Line Input #FileNumber, TextLine
'look for line of text that has "FileInfo=" in it
If InStr(1, TextLine, "FileInfo=") <> 0 Then
List1.AddItem TextLine
List1.Refresh
End If
Loop
Close FileNumber
-
Thanks.
But how do I exclude the FileInfo= from the list?
I only want to show the info that is coming after it.
Anyway thanks a lot.
-Lumin
-
this will eliminate FileInfo=
Code:
List1.AddItem Mid$(TextLine,10)