Rank: Advanced Member Groups: Member
Joined: 4/22/2008 Posts: 75
|
OK your Demo and Documentation on this is a little hard to understand. Your demo for a server side task has a for loop 0 to 99 to increment the progress bar by one each time. And it has a sectio where im suppose to run my server side task, which is dynamically building a TreeView form a DataBase. But this code would make it run my task 99 times which is use less correct? or how do i change this or force the progress bar to stop?
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
You completely misunderstood. The key for any progress bar solution is that you are responsible to update the progress information. So basically if your TreeView has 10 nodes, you need to come back to tell the progress bar that you are 10% done after creating the first node, then come back to tell the progress bar that now you are 20% after you created the second node. Of course, you are also free to tell the progress bar that you are 50% done after you opened a connection to the database, 80% done after you’ve created the first node, etc. The point is, first, the progress bar takes whatever progress information you give to it and display it and it does nothing more than that, which means you are solely responsible to provide the progress information; secondly, It’s not that you are doing your work multiple times. It’s just that you need to come out of your work midway repeatly and tell the progress bar where you are now. The progress bar won’t update anything if you don’t do that because it has no clue where you are unless you tell it.
Instead of accepting one percentage value, the ProgressBar accepts 3 values: Minimum, Maximum and Position. Property Minimum and Maximum is usually set to a fixed value. Position is the one that you change. This saves you from calculating percentage value. For example, if you have a lengthy operation with 7 steps, you can set Minimum to 0, Maximum to 1, and then update its position from 0 to 7 while your work finishes each step. As soon as you reach 7, the progress bar displays 100%. Thanks
|
Rank: Advanced Member Groups: Member
Joined: 4/22/2008 Posts: 75
|
OK that clears a lot of things up and now i better understand how to use the progress bar for my situation thank you.
|