What I do when I have a rapidly changing item on the screen, eg a counter of incoming bytes, is:
everytime a on-screen variable is updated, set a flag to indicate that it needs to be refreshed on-screen
For I = 1 to 1000000000
LoopNumber = I
RefreshFlag = True
DoStuff
Sleep(0) or Sleep(1) to enable other stuff to happen too
Next
and then in a timer tick (somewhere between 3 and 20 times per second, to balance CPU load vs user dazzle)
Sub tmrRefresh_Tick
If RefreshFlag Then
RefreshFlag = False 'clear flag first, just in case any updates occur during the next three lines
lblLoopNumber.Text = LoopNumber
lblSomethingElse.Text = SomethingElse
lblButWaitTheresMore.Text = ButWaitTheresMore & " !!!"
End If
If RefreshStatusFlag then
RefreshStatusFlag = False
lblStatusLine.Text = "S1:" & ThisStatus & " S2:" & ThatStatus & " LS:" & LinkStatus
End If
End Sub
This has the side-benefits of:
(1) not doing non-string to string conversions if the activity is not on screen (because you disable timers when an activity is paused), and
(2) automatically loading up all the screen display views on the first timer tick when an activity is resumed (or started)
(assuming you set all refresh flags = True in the activity resume routine)
(vs what I often see -
and sometimes do myself - is the same code twice: once to initialize the view, and then again to update it)