|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (6 bit)
Join Date: Dec 2002
Location: Victoria, Australia
Posts: 50
|
VB...text file & progress bar
Hi, i a semi beginner at visual basic and my latest program i'm building is a basic database. I want to use a progress bar to show the user how much of the data file has been read. The file contains records like this:
name,subj1,subj1mark, subj2,subj2mark,subj3,subj3mark subj1-3 & subj1mark - 3 are variables. They are read from the file like this: Open cdlOpen.Filename for as...etc. Do Until EOF(1) With student(recNumber) Input #1, .StudentName, .subj1, .subj1mark, .subj2, .subj2mark, .subj3, .subj3mark End With recNumber = recNumber + 1 Loop recNumber is the record number. I want a progress bar that first determines the amount of records, then sets its max value to that, then for each record read from the file increments the progress bar value by 1. I tried this by putting in a second do until...loop above the normal one but the program just crashed trying to run both. Can anybody help? |
|
|
|
|
|
#2 |
|
Professional gadfly
|
If you go the dual loop route, you will have to probably close and reopen the file after you do the first loop to count the number of records. Otherwise, after the first loop is run, you are at the end of the file, and the second loop won't work.
Another thing you could try is determining the size of the file, and then dividing it by the average size of a record. You will get an approximate number of records to use as the number for the status bar. It would be quicker as well. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|