Solved

Read text file

Posted on 2006-06-10
3
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

690 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