Results 1 to 3 of 3

Thread: Progress bar help...Reading files and Remote Databases.

  1. #1

    Thread Starter
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336

    Progress bar help...Reading files and Remote Databases.

    Are there any good tutorials or any "tricks" to, for instance" make a progress bar give an accurate representation of conecting to and retrieving data from remote database?


    In my app I am doing some file readin and remote database connections. Basicaly here is how it works in pesudocode.

    • *Open Folder

      *Read all .env (realy dbase files with different extensions) files and get a list of the ones that are newer than the last time I checked.

      *Open each .env file and read it and determine what other files are associated with it.

      *Open the associated files and get all the contents I need

      *Post all of that content to my remote database

      * close file

      * Move on to next file and repeat


    This happens every so many minutes (as chosen by the user) and there are always new files in the folder (could be 1 to 50, or more if it is the first time the program is running)

    As you can see, that could be pretty processor and time intensive and I would like to provide the user with some feedback as to how long it is going o take and how far along in the process it is.

    Is there an accurate way to show the whole of this progress using a progress bar? Since there are a couple differetn kinds of operations involved (i.e. counting files, opening files and reading them, assembly the info, posting to a database and accounting for delay times with the net) it seems like it would be hard to get a single overall progress.

    But if anyone has any input I would love it!

    Thanks!
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Progress bar help...Reading files and Remote Databases.

    You cannot report anything to the user that you cannot measure yourself. If you have 50 files to process then you can report to the user a progress change after each file has been processed, but you cannot report the progress of a DataAdapter's Fill method to the user because it doesn't report any progress to you.

    It's up to you to determine what you can actually measure and then determine how best to represent that to the user. For instance, if you have 10 files to process then you may show 10 equal steps on your progress bar. If one of the files is 10 times bigger than all the others though, that will not really give an accurate impression to the user. It would be preferable to use 19 steps and have the big file jump 10 of those steps with the others jumping just one.

    That said, if you have no way of knowing that that file will take 10 times longer to process than the others then you can't make that decision. For instance, if you are getting all the data from 10 tables and one of them has 10 times as many rows as the others, you have no way of knowing ahead of time that that's the case. You just have to make a best guess and display that to the user.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336

    Re: Progress bar help...Reading files and Remote Databases.

    Yah, I just wasn't sure if there was some sort of asynchronous reporting back from the database that updates it's status every so many milliseconds or something. Kind of like when you download a file off the net and you see a progress bar and an estimated time left kind of thing.

    I know there is no simple answer to this, but any input I can get might give me some ideas.

    Thanks for the input.
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width