Click to See Complete Forum and Search --> : searching a text file


nolc
October 16th, 2001, 11:48 AM
Does anyone know how to programmatically open an existing text file. Then search through a comma delimited file(like the portion below) for a string, '475'.

16,301,13981439,Z,IA0010,012040/
16,301,4756071,Z,IA00045,000000/
16,475,72363175,Z,IA00025,012040/
16,475,42736600,Z,IA00025,012050/

Thank you

No L c
VB Developer

Iouri
October 16th, 2001, 12:31 PM
Dim sLine As String
Dim aryInput() As String
Dim i As Integer


Open "c:\file.txt" For Input As #1 'to read from
Do While Not EOF(1)
Line Input #1, sLine
aryInput = Split(sLine,",")
For i = LBound(aryInput) To UBound(aryInput)
if aryInput(i) = '475' then
...do something
end if
Next


Loop
Close #1


Iouri Boutchkine
iouri@hotsheet.com

nolc
October 16th, 2001, 02:29 PM
thank you for the response

No L c
VB Developer