Visual Basic - Need a quick help I need a sub that can read a text file line by line System.IO. But i want it to delay a bit OR If you can fix my script so it would work right Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim FILE_NAME As String = TextBox2.Text Dim TextLine As String If System.IO.File.Exists(FILE_NAME) = True Then Dim objReader As New System.IO.StreamReader(FILE_NAME) Do While objReader.Peek() >< -1 TextLine = objReader.ReadLine() TextBox1.Text = TextLine ' i need it to sleep 5 seconds Loop Else MsgBox("error") End If End Sub Code (markup):
You can make a 5 second delay with this line: system.threading.thread.sleep(5000) Also I think Do While objReader.Peek() >< -1 should be Do While objReader.Peek() <> -1 -Jim
hold up it was like that i want to make it so that it picks 1 line and then waits 5 seconds and then goes to line 2.
Did you try this? Do While objReader.Peek() <> -1 TextLine = objReader.ReadLine() TextBox1.Text = TextLine ' stop for 5 seconds System.Threading.Thread.Sleep(5000) Loop -Jim