Solved

Read text file

Posted on 2006-06-10
3
191 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now