I have inputted all information in a text file into a list:
Try
sourceFile = "\My Documents\TOPR1.TXT"
Dim objReader AsNew IO.StreamReader(sourcefile)
'Peek returns a value of -1 when there are no more...
'...incoming characters thereby signifying EOF
'Add all items in TOPR1.TXT to a list
While objReader.Peek <> -1
infoList.Add(objReader.ReadLine.Trim())
EndWhile
objReader.Close()
Catch ex As Exception
txtWo.Text = "I/O ERROR"
EndTry
----------
What I need now to do is to search the whole list for an item scanned by a handheld scanner which is in e.text. Please note that each line item in the list contains many strings, some of them separated by spaces and commas, and string I am searching for is a SUBSTRING of one of the STRINGS in a line item.
Will this line do the job?
IfNot (infoList.Contains(e.Text)) Then
txtWo.Text = "NO ENTRY"
EndIf
Try
sourceFile = "\My Documents\TOPR1.TXT"
Dim objReader AsNew IO.StreamReader(sourcefile)
'Peek returns a value of -1 when there are no more...
'...incoming characters thereby signifying EOF
'Add all items in TOPR1.TXT to a list
While objReader.Peek <> -1
infoList.Add(objReader.ReadLine.Trim())
EndWhile
objReader.Close()
Catch ex As Exception
txtWo.Text = "I/O ERROR"
EndTry
----------
What I need now to do is to search the whole list for an item scanned by a handheld scanner which is in e.text. Please note that each line item in the list contains many strings, some of them separated by spaces and commas, and string I am searching for is a SUBSTRING of one of the STRINGS in a line item.
Will this line do the job?
IfNot (infoList.Contains(e.Text)) Then
txtWo.Text = "NO ENTRY"
EndIf