473,378 Members | 1,405 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Read sequential file using VB

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
5 4246
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

"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
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

"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michael Van Altena via .NET 247 | last post by:
I'm trying to figure out how to read a formatted binary file intoa structure definition in C#. I've tried using the"StructLayout" attribute with both LayoutKind.Explicit andLayoutKind.Sequential...
6
by: Rolf Schroedter | last post by:
(Sorry for cross-posting). I need to access large files > 2GByte (Linux, WinXP/NTFS) using the standard C-library calls. Till today I thought I know how to do it, namely for Win32: Use open(),...
3
by: Dave Coate | last post by:
Hello again, I am going to re-post a question. I got some excellent suggestions from Rob and Mattias on this but their ideas did not solve the problem. Here is the original post: ...
0
by: anzhi | last post by:
Hi, I hv a number field in a sequential file. what i need to do is to read this file, sum up this number and at last display the grand total into my existing VB application. Do anyone know how to...
7
by: Hallvard B Furuseth | last post by:
I'm trying to clean up a program which does arithmetic on text file positions, and also reads text files in binary mode. I can't easily get rid of it all, so I'm wondering which of the following...
3
by: utab | last post by:
Dear all, What are the advantages of binary files over text files? I would like to search for a specific value of a variable in an output file, I was doing this lately by the string library...
12
by: Sean Davis | last post by:
I am working on a simple script to read from one database (oracle) and write to another (postgresql). I retrieve the data from oracle in chunks and drop the data to postgresql continuously. The...
11
by: Timofmars | last post by:
I'm try to Unload DB2 data from a table into a record sequential file on NT. I can an unload on Mainframe, but it doesn't seem to be an option in NT. In NT, all I can do is export/import. I can...
1
by: dhingchangs | last post by:
Hi, I want to read a sequential file character by character and the check each character for the position and process further. The lenght of file can be anything. Actually my purpose is read a...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.