Results 1 to 6 of 6

Thread: Progressbar for generating hash

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2005
    Posts
    355

    Progressbar for generating hash

    Hi,

    I wish to create a progress bar for my program to compute hashes like SHA1.

    Currently if I were to generate the hash from a large file, the application will look as if it is hang particularly when user click inside the form.

    I am not sure whether progressbar is a good solution that can help to solve this issue, or at least let user know know the current progress so that they will wait for the computation to complete.

    I came across a few methods for coding progress bar which mostly is based on manual coding/calculation. I wonder is there an automatic way which will generate the progress bar based on the class/function that I use e.g. SHA1CryptoServiceProvider

    Please advise.

    Thanks

  2. #2
    Addicted Member
    Join Date
    Jan 2013
    Posts
    177

    Re: Progressbar for generating hash

    Quote Originally Posted by abcat View Post
    Hi,

    I wish to create a progress bar for my program to compute hashes like SHA1.

    Currently if I were to generate the hash from a large file, the application will look as if it is hang particularly when user click inside the form.

    I am not sure whether progressbar is a good solution that can help to solve this issue, or at least let user know know the current progress so that they will wait for the computation to complete.

    I came across a few methods for coding progress bar which mostly is based on manual coding/calculation. I wonder is there an automatic way which will generate the progress bar based on the class/function that I use e.g. SHA1CryptoServiceProvider

    Please advise.

    Thanks
    A Progress bar would be your 2nd step, first look into using a Background Worker so your UI thread is free.

    What is happening right now is your generating your Hash on the same thread as what your UI uses, so when the hash is being generated your UI is not able to work and redraw/function. So even if you put a progress bar it would not work.
    Also instead of a progress bad showing total progress you could show the progress bar repeatedly going from 0 to 100 like some programs do

    I am not well versed with background workers but perhaps someone else can chime in.

  3. #3
    Lively Member
    Join Date
    Feb 2012
    Posts
    90

    Re: Progressbar for generating hash

    instead of a progress bar, something real simple that could let the user know it's working is change the cursor to the wait Me.Cursor = Cursors.WaitCursor then change it back to .default after it's complete.

    Pat

  4. #4
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Progressbar for generating hash

    I'd jsut use the progressbar in marquee mode... otherwise you have to figure out what the progression is... and unless the hash process reports how far along it is (unlikely) a traditional progbar that fills up isn't going to be accurate or easy to manage.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2005
    Posts
    355

    Re: Progressbar for generating hash

    Based on all the responses, it is recommended for me to use a Background Worker so that my UI will not be 'hang' while computing. For the progress bar, I can use either a WaitCursor or ProgressBar (Marquee) to show just a loading indicator without any actual cacluation.

    I guess this would be best and recommended way instead of going into the complex calculation.

    Nevertheless, thanks for all the help

  6. #6
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Progressbar for generating hash

    yyyyyup, that's it in a nutshell.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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