hi i have a huge txt file
Acct= 1452 Name= Mahesh
Book=124856
now i have a huge txt file which has this data and i want to find a particuler Acct: and it should give me the Name and Book
any ideas how to fo that in vb
plz help if can
sumesh
[Edited by sumesh11 on 06-10-2005 at 08:28 PM GMT]
06-10-2005 at 08:28 PM
|
TJ_01 Level: VB Lord Registered: 24-08-2005 Posts: 320
Re: Search a keyword in txt and pull the data
Would this code helps?
This code finds a word depend on your input in a text file and if found the pull the data into text2.
Private Sub Command1_Click()
Dim txtvar As String
Dim file As Integer
Dim b As String
file = FreeFile
Open "C:\a.txt" For Input As #file
Do Until EOF(file)
Line Input #file, Ln
If InStr(Ln, Text1.Text) > 0 Then
MsgBox "String Found"
Text2.Text = Text1.Text
Else
MsgBox "String Not Found"
Text2.Text = ""
End If
Loop
Close #file
End Sub