Just out of interest what is generating the file in the first place? Also instead of just looping in a timer you could use a FileSystemWatcher component from the toolbar to notify you on changes to the file.
Also rather than reading the file line by line you could do a sr.ReadToEnd() to read the entire file into memory in one hit andthen process it. Possibly even skipping to the last read line and only appending new data to the textbox rather than reloading the entire thing.
Although it won't solve your problem you might want to replace some of the VB6 code (Dir etc) with the .Net equivalent
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'check to see if file exists if so delete and recopy
If File.Exists("C:\access2.log") Then
File.Delete("C:\access2.log")
End If
System.IO.File.Copy("C:\access.log", "C:\access2.log") 'copy file because its in use
'end check
Timer1.Enabled = False
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim fileDetails_new As FileInfo = New FileInfo("C:\access2.log")
Dim fileDetails_reg As FileInfo = New FileInfo("C:\access.log")
If fileDetails_new.Length.ToString() <> fileDetails_reg.Length.ToString() Then
Dim sr As StreamReader = New StreamReader("C:\access2.log")
Dim line As String
Do 'looping reading each line at a time
line = sr.ReadLine()
If TextBox1.Text = "" Then 'make sure you dont have a blank line at start
TextBox1.Text = line.Substring(1, 13)
Else
TextBox1.Text = TextBox1.Text & vbCrLf & line.Substring(1, 13)
End If
Loop Until line = Nothing 'loop until the end
Me.Show() 'set the caret and redraw to scroll to bottom
TextBox1.SelectionStart = TextBox1.Text.Length
TextBox1.ScrollToCaret()
sr.Close() 'close the streamreader
End If
End Sub
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
File.Delete("C:\access2.log")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
End Sub