Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27189

VS 2010 Stream Readers

$
0
0
Hi there

If possible i would like some advise on streamreaders.
For one of my projects it is neccessary log all its actions (Which aren't that many overall) I use a simple text file to do this. To read the logs in to the Log viewer screen I use a streamreader with the command

Code:

TxtLogs.text  = sr.ReadToEnd
This works great... However i normally only have to look at this every week or so (or if something goes wrong) and seeing as im only normally interested in the last few logs i have to scroll right to the bottom, which is hasstles!!!!

Is there way to get the stream reader to start at the end and work its way back, Or is there a better soloution

I have already tried

Code:

        sr = New StreamReader(Application.StartupPath + "\Logs\Logs.txt")
        TxtLogs.Text = ""
        Dim logstr As String() = sr.ReadToEnd.Split(vbCrLf)
        sr.Close()
        Dim i As Integer = logstr.Count - 1
        While i <> 0
            If TxtLogs.Text <> "" Then
                TxtLogs.Text += vbCrLf
            End If
            TxtLogs.Text += logstr(i)
            i -= 1
        End While
    End Sub

but this takes a couple of seconds to refresh. any ideas

Many thanks

Ian

Viewing all articles
Browse latest Browse all 27189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>