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![]()

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.
547 :big_grin:
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
Last edited by Mentor; 03-05-2007 at 07:29 PM.
that should work cant test it at the moment because i haven't got vb 6 installedIn 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![]()
Want to hide these adverts? Register an account for free!