Vb net progressbar not updating prices of online dating services
Well..simplistic answer is to run those commands in the Do Work() handler of a Background Worker()!
Another approach is to use actual minimum and maximum values from a list of tasks you're performing.Thread(Address Of Do Long Running Process) ' Start the background process thread background Thread. Show() End Sub ' The long running process Public Sub Do Long Running Process() ' Set the flag that indicates if a ' process is currently running is Process Running = True ' Iterate from 0 - 100 ' On each iteration, pause the thread ' for .05 seconds, then update the ' dialog's progress bar For n As Integer = 0 To 100 Thread. Update Progress(n) Next ' Show a dialog box that confirms the process ' has completed Message Box. This ' uses the Invoke Required and Begin Invoke methods Public Sub Update Progress(By Val progress As Integer) If Progress Bar1. Begin Invoke(New Delegate Update(Address Of Update Delegate Impl), progress) Else Progress Bar1.Value = progress End If End Sub ' Overloads the Close method Public Overloads Sub Close() If Me. Begin Invoke(New _ Delegate Close(Address Of Close Delegate Impl), Me) Else Me. Text = progress & CStr("%") End Sub ' Implmentation of the Delegate Close Sub Close Delegate Impl(By Ref dialog As Form) dialog. I had programmed in Visual Basic 4 many many years ago.To cut a long story short, the requirement was to let the long running task continue while a progress bar showed the progress of the task.