Progress Bar and Loading Files

be58d2003

Well-known member
Joined
Mar 23, 2003
Messages
81
Location
Antioch, California
I know this has been posted (kinda, searched first)...

I am working on a little program, and I need to read three .txt files, however... one of them takes a little bit of time to load (there is about 25,000 lines of text... dont ask). I want the user to be able to track the status of the loading progress. How can I do this? I use the LineInput(1) method, because I need to use the EOF(1) function so it works with another (one that I didnt create) program that, then in turn converts it from a .txt file to one that is read by M$ Flight Simulator.

Also, the reason I am using the LineInput function, is that seems to be the only way I can add the files (two of three) do a ComboBox (dropdown) list. Anyone?
 
Eek :eek:. LineInput is one of the old VB6 methods ported over to .NET,
and should thus be avoided. Instead, create a FileStream of the
text file, and use the StreamReader to read it line by line, or
by blocks of text. The Stream has a Length property which will
tell you the total length of the file, and a Position property to
show where in the stream you are reading from. A little bit of
simple math will get you a percentage of the file read, which you
can apply to the ProgressBar.

Read up on it [mshelp=ms-help://MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconreadingtextfromfile.htm]here[/mshelp].
 
Cool, thanks... I will have to look more in depth into the StreamReader class.
Loop Until line Is Nothing

This is where I was having the problem... I didnt know about using this line!

I think this will solve my problem! Thanks for the link Bucky.
 
Back
Top