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:)
Printable View
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.
no ill try pseudo code it.
Begin
Read "hello.txt"
Seperate lines
Alert each line
End
In what language?
Vb6 would be for exsample:
Code: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