Want to [red]search a word from a text file[/red], having a sentences. The procedure below has the [red]variable CHECK[/red] that extracts a sentence from 44.txt file and in that sentence, [red]variable DATA (having a word)[/red] is checking the word, which the following code doesn't do and
the record pointer of file 44.txt doesn't goes to second line. It has the [red]following 2 errors[/red]
[red] 1) To check word from a sentence
2) To record pointer to move next line in file 44.txt[/red]
Private Sub Command1_Click()
Dim FileKey As String
Dim FileNews As String
Dim Data As String
Dim Check As String
Dim counter As Integer
FileKey = "d:\my documents\keyword.txt"
Open FileKey For Input As #1
FileNews = "d:\my documents\44.txt"
Open FileNews For Input As #2
Do Until EOF(2)
Line Input #1, Data
Line Input #2, Check
If Data = check Then
Text1.Text = Text1.Text & vbCrLf & Data
counter = counter + 1
Else
'MsgBox "not found"
End If
Loop
Close #1, #2
End Sub
the record pointer of file 44.txt doesn't goes to second line. It has the [red]following 2 errors[/red]
[red] 1) To check word from a sentence
2) To record pointer to move next line in file 44.txt[/red]
Private Sub Command1_Click()
Dim FileKey As String
Dim FileNews As String
Dim Data As String
Dim Check As String
Dim counter As Integer
FileKey = "d:\my documents\keyword.txt"
Open FileKey For Input As #1
FileNews = "d:\my documents\44.txt"
Open FileNews For Input As #2
Do Until EOF(2)
Line Input #1, Data
Line Input #2, Check
If Data = check Then
Text1.Text = Text1.Text & vbCrLf & Data
counter = counter + 1
Else
'MsgBox "not found"
End If
Loop
Close #1, #2
End Sub