Creatica Level: Protégé
 Registered: 01-02-2007 Posts: 4
|
Searching a text file for information
I have a text file with a few lines of data, for example:
---------
John-Smith
Mike-Grey
Susan-Bennet
---------
I want to be able to type in a name (i.e. John, Mike, Susan) and have it look in the file and display the last name. I can get it to do so with the first line but can not figure out how to have it look line by line.
--------
dim fso as New FileSystemObject
dim ts as TextStream
dim strline as string
dim strFirstName as string
Set ts = fso.OpenTextFile("c:\test.txt", ForReading, True)
strline = ts.ReadLine
ts.Close
strUserData = Split(strline, "-")
--------
Is there a way to have it look at the first line, and if it does not match, look at the next line, then the next, etc.? Thank you!
~Creatica
|