Introduction: Vb ListBox Update

About: Well ...

Recently I had to make simple serial data logger. The particular data in this case was temperature, but in general the logger can display any row/line of comma delimited values. The serial data was sent from Arduino. The problem was the update of a list box control. He was flickering and if you scroll down any update returned the scroll position on the top. This is annoying especially if the update interval is relatively fast.

I read about many solutions as creating own control and etc. Everything was too complicate for me and for my purposes. So playing around with the control properties and functions I came to my own solution.

Step 1:

The code speaks by himself. A timer is generating random number. The numbers are populated in the List Box. Before the update just read the current Top Index of the List Box. During the update switch off the rendering by Begin Update. Then restore the Top Index and call End Update.

I put an extra Scroll Bar, linked to the List Box.

That is. Thank you.