Solved

Read text file

Posted on 2006-06-10
3
213 Views
Last Modified: 2012-05-05
I need to read the last few lines of a text file that start with today's date and display on a text box. Example, it always start with today's date,  6/10/06(tab)Error log number and error message.
0
Comment
Question by:VBdotnet2005
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
vadim63 earned 500 total points
ID: 16877457
  Private Sub ReadFile()

        Dim sr As New System.IO.StreamReader("C:\test.txt")
        Dim Line As String = sr.ReadLine()
        Dim strToday() As String
        TextBox1.Multiline = True

        Do While Line IsNot Nothing
            strToday = Split(Line, vbTab)
            If strToday(0) = Today Then TextBox1.Text += Line & vbCrLf
            Line = sr.ReadLine()
        Loop

    End Sub
0
 

Author Comment

by:VBdotnet2005
ID: 16877477
Great example. Thank you :)
0
 
LVL 10

Expert Comment

by:vadim63
ID: 16877490
You're welcome.
Cheers.
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question