View Full Version : [need quick response] Read a line from a text file
Blinger1
02-05-2007, 11:04 AM
How do i read a line from a text file? i need to read a single line, msgbox what the line says and then do the same for the next line.
+rep to helpers:)
What? If you mean find text Ctrl + F.
Blinger1
03-05-2007, 06:17 AM
no ill try pseudo code it.
Begin
Read "hello.txt"
Seperate lines
Alert each line
End
Mentor
03-05-2007, 07:27 PM
In what language?
Vb6 would be for exsample:
Private Sub getline_Click()
'line to get
getline = 8
usefile = "C:\somefile.txt"
'open file
Open usefile For Input As #1
curline = 1
'loop till line found
Do Until stopme Or EOF(1)
Line Input #1, linetext
'if this is the line stop looping and msgbox it
If curline = getline Then
stopme = True
MsgBox linetext
End If
curline = curline + 1
Loop
Close #1
End Sub
Blinger1
04-05-2007, 10:48 PM
In what language?
Vb6 would be for exsample:
Private Sub getline_Click()
'line to get
getline = 8
usefile = "C:\somefile.txt"
'open file
Open usefile For Input As #1
curline = 1
'loop till line found
Do Until stopme Or EOF(1)
Line Input #1, linetext
'if this is the line stop looping and msgbox it
If curline = getline Then
stopme = True
MsgBox linetext
End If
curline = curline + 1
Loop
Close #1
End Sub
that should work cant test it at the moment because i haven't got vb 6 installed :P
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.