Live .log file watcher in rtb
Hi,
From ling time I'm fighting with program which would watch specific log file and put last line into textbox.
I tried many things but it didn't work.
1. Put .log file patch to navigate webbrowser, put inner text to richtextbox and put last line to textbox. When i started navigated the log file was opening normaly in notepad and webbrowers show error.
Code:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Try
WebBrowser1.Navigate(TextBox1.Text)
Timer1.Enabled = True
Catch ex As Exception
End Try
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
WebBrowser1.Refresh()
RichTextBox1.Text = WebBrowser1.Document.Body.InnerText
TextBox2.Text = RichTextBox1.Lines(RichTextBox1.Lines.Length - 1)
End Sub
2. Stream plain text direcly to richtextbox and then to textbox but app generating log file stopped saving new logs.
Code:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Try
Timer1.Enabled = True
Catch ex As Exception
End Try
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
RichTextBox1.LoadFile(TextBox1.Text, RichTextBoxStreamType.PlainText)
TextBox2.Text = RichTextBox1.Lines(RichTextBox1.Lines.Length - 1)
End Sub
Could you help me with that?