Vb to generate txt file report

I have a text file contains:

a b c d
e f g h
j k e j

How do I can create a VB application to read this text file and generate a report?...and from the report itself i also can see the total listing in the text file....

thanks
operation1612Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonMiddle School Assistant TeacherCommented:
What should be in the report besides the contents of the text file?
0
DhaestCommented:
Standard flat file Read and write routines:

Read:
    Dim intFileHandle As Integer
    Dim strRETP As String
    intFileHandle = FreeFile
    Open "path to file" For Input As #intFileHandle
    Do While Not EOF(intFileHandle)
        Line Input #intFileHandle, strRETP
        MsgBox strRETP
    Loop
    Close #intFileHandle

Write (creates a new file overwriting any existing file):
    Dim intFileHandle As Integer
    Dim strRETP As String
    strRETP = "Hi There"
    intFileHandle = FreeFile
    Open "path to file" For Output As #intFileHandle
    Print #intFileHandle, "---------------------------"
    Print #intFileHandle, strRETP
    Print #intFileHandle, "---------------------------"
    Close #intFileHandle

Write (appends data to an existing file):
    Dim intFileHandle As Integer
    Dim strRETP As String
    strRETP = "Hi There"
    intFileHandle = FreeFile
    Open "path to file" For Append As #intFileHandle
    Print #intFileHandle, "---------------------------"
    Print #intFileHandle, strRETP
    Print #intFileHandle, "---------------------------"
    Close #intFileHandle


Some remarks:
1) You should use "Write" instead of "Print" to output comma separated values. e.g.:
Dim iOne as integer, iTwo as integer, iThree as String
iOne=1
iTwo=12
iThree="A"
...
Write #intFileHandle, iOne,iTwo,iThree
...
Gives this output:
1,12,A

etc.

2) You should then use "Input" not "Line Input" to read the comma separated values:
Dim xOne as integer, xTwo as integer, xThree as String
...
Input #intFileHandle, xOne,xTwo,xThree
...

This reads each separated value into the specified variables...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
operation1612Author Commented:
tq
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.