StrataFrame Forum

displaying a text box

http://forum.strataframe.net/Topic26901.aspx

By Ger Cannoll - 4/19/2010

I know this should be simple enough ...I am looping through a table and want to show the count as I am looping through. So I have  txtBox.text= myCount;  txtBox.refresh(); This shows the counter initially ok but if I click off the form and back on it for any reason, the number in the text box stops refreshing, even though the loop continues ok. Is there something I need to do to keep the textbox refreshing ?
By Peter Jones - 4/19/2010

Hi,



Don't know if this will make any difference but try refreshing the form rather than the control.



Cheers, Peter
By Edhy Rijo - 4/19/2010

Gerard O Carroll (04/19/2010)
Is there something I need to do to keep the textbox refreshing ?




Hi Gerard,



Yes, you can use a BackgroundWorker to update the textbox. Basically the problem is that you are using the form's thread to update the textbox from the loop and if you move out of the form, that thread will not continue to refresh the textbox, you need to use a separate thread to do that.



The BackgroundWorker is pretty easy to use and there are lot of samples in Google on how to use it.
By Dustin Taylor - 4/20/2010

BackgroundWorkers are definately the way to go here Smile. Let us know if your un into any hickups!
By Ger Cannoll - 4/22/2010

Hi Folks. Thnaks for your contribution.

I'll read up on background workers..

Regard, Gerard