Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 04-14-2003, 07:59 PM   #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?
nickuss is offline   Reply With Quote
Old 04-15-2003, 08:17 AM   #2
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
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.
doctorgonzo is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:57 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2