By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,640 Members | 1,331 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,640 IT Pros & Developers. It's quick & easy.

Read sequential file using VB

P: n/a
I have a number field in a sequential file. Im going to read this file,
sum up this number and display the grand total in my application using
VB. Do anyone know how to do that??
Thanks in advance!

Apr 5 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Leesa,
I have a number field in a sequential file. Im going to read this file,
sum up this number and display the grand total in my application using
VB. Do anyone know how to do that??

This is so basic programming.
Try to get a book about programming it does not matter how old it is.
Than get VBExpress

What you have to do is open a windowsform project
Drag from the toolbox a label on the form that is created
Click on that form
Search for MSDN.microsoft.com for "streamreader"
Follow one of the samples on that page

I hope this helps,

Cor
Apr 5 '06 #2

P: n/a

"leesa" <an*****@gmail.com> wrote in message
news:11*********************@v46g2000cwv.googlegro ups.com...
I have a number field in a sequential file. Im going to read this file,
sum up this number and display the grand total in my application using
VB. Do anyone know how to do that??


Dim fileReader As System.IO.StreamReader
fileReader = My.Computer.FileSystem.OpenTextFileReader ("C:\File.txt")
Dim myData As String
Do
myData = fileReader.ReadLine()
Loop While Not fileReader.EndOfStream

Apr 5 '06 #3

P: n/a
Homer,

If you write it so exact, would you not count in the routine.

Something as
Dim fileReader As System.IO.StreamReader
fileReader = My.Computer.FileSystem.OpenTextFileReader ("C:\File.txt")
Dim myData As String label1.text = "" Do
myData = fileReader.ReadLine() Label1.text = CDbl(Label1.Text) + CDbl(myData.Substring(0,6))
'to count the first 6 characters
Loop While Not fileReader.EndOfStream

:-))

Cor
Apr 5 '06 #4

P: n/a

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:uK*************@TK2MSFTNGP05.phx.gbl...

If you write it so exact, would you not count in the routine.

Something as

....

Sure. I have a bunch of code in there for my purpose but the OP needs to add
his summing code.

Apr 5 '06 #5

P: n/a
hi Cor and Homer,

Thanks for ur explanation and code example ya. Very grateful to get
feedback from u guys. thanks!

Apr 5 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.