Community discussion forum

problem with a progressbar : it dispears

  • 1 month ago

     

    I have  two userforms .One is  a progressbar  that I made. The other  is  a userform that   contains a   long code.The  progressbar allows the user  to see  the percentage of the execution.   My problem  is the progressbar dispears each step of the execution  of  the principal code. How can I maintain  the progressbar until  the end of the execution.

  • Advertisement

    Simply the fastest line-level profiler for .NET ever

    “The low overhead means it has minimal impact on the execution of my program”
    Mark Everest, Development Team Leader, Renault F1 Team Ltd.

    Try out the new ANTS Profiler 4 for yourself. Download your 14-day trial now

  • 1 month ago

    I did some testing and the following worked without too much delay:

    frmProgressBar.Visible = True
    Me.Hide
    For i = 1 To 1000000
        frmProgressBar.ProgressBar1.Value = i / 10000
        DoEvents
    Next i
    Me.Visible = True
    

    If I did a frmProgressBar.Refresh inside the loop, or even a frmProgressBar.ProgressBar1.Refresh, it slowed the loop down, but if you have a massive amount of code going on, the performance hit may be acceptable.

    Hope this helps!

Post a reply

Enter your message below

Sign in or Join us (it's free).