# JProgressBar refresh

**URL:** <https://forum.servoy.com/t/jprogressbar-refresh/13689>\
**Category:** Classic Servoy\
**Created:** [March 7, 2011, 10:49am UTC](https://forum.servoy.com/t/jprogressbar-refresh/13689 "2011-03-07T10:49:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ttmgybta](https://avatars.discourse-cdn.com/v4/letter/t/3e96dc/32.png) [@ttmgybta](https://forum.servoy.com/u/ttmgybta)\
**Post date:** [March 7, 2011, 10:49am UTC](https://forum.servoy.com/t/jprogressbar-refresh/13689/1 "2011-03-07T10:49:13Z")

</div>

JProgressBar question

I placed a progress bar on my form and it works almost fine.  
But the application.updateUI() slows everything down, It doesn’t makes any sense to add a this Progress bar.

Dose somebody have a suggestion, how I can speed this up?

Regards  
ttmgybta

---

<div class="post-metadata">

**Author:** ![ROCLASI](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/roclasi/32/4371_2.png) [@ROCLASI](https://forum.servoy.com/u/ROCLASI)\
**Post date:** [March 7, 2011, 11:02am UTC](https://forum.servoy.com/t/jprogressbar-refresh/13689/2 "2011-03-07T11:02:20Z")

</div>

Hi,

I guess you are you calling application.updateUI() in a loop and do that for every iteration.  
You better call the updateUI() at a larger interval (depending on your needs). You can do this by using the following code:

```auto
// start of loop

// only update every 50 iterations
// adjust accordingly to your own needs.
if ( iterationNr%50 == 0 ) {
     application.updateUI();
}

// end loop

```

Hope this helps.

---

<div class="post-metadata">

**Author:** ![ttmgybta](https://avatars.discourse-cdn.com/v4/letter/t/3e96dc/32.png) [@ttmgybta](https://forum.servoy.com/u/ttmgybta)\
**Post date:** [March 7, 2011, 12:48pm UTC](https://forum.servoy.com/t/jprogressbar-refresh/13689/3 "2011-03-07T12:48:09Z")

</div>

Thank you, Robert.

It is much faster now.  
My next problem is that I want to set the maximum value from a Foundset whit.  
elements.bar\_progress.setMaximum(foundset.getSize())  
But it just sets the first 200 which are loaded in the foundset, how do I get the real size of the foundset?

Regards  
ttmgybta

---

<div class="post-metadata">

**Author:** ![ROCLASI](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/roclasi/32/4371_2.png) [@ROCLASI](https://forum.servoy.com/u/ROCLASI)\
**Post date:** [March 7, 2011, 1:03pm UTC](https://forum.servoy.com/t/jprogressbar-refresh/13689/4 "2011-03-07T13:03:50Z")

</div>

Use the getFoundSetCount() function in the databaseManager:

```auto
var _nMax = databaseManager.getFoundSetCount(foundset)

```
