UI hangs while updating 1000 labels

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prasad599
    New Member
    • Feb 2009
    • 24

    UI hangs while updating 1000 labels

    Hi,

    I have a windows form where i try to update a form which has 1000 labels. By update i mean i try to set the color of the labels. And i am doing this update in windows form timer every 1 sec.
    My problem is the UI freezes. I tried using a thread. In the thread i tried to call the update code, but still the UI hangs.
  • !NoItAll
    Contributor
    • May 2006
    • 297

    #2
    We need to see some code to really help you.
    Generally, however, this is the result of a loop that is just too tight. Inside your loop try either calling Threading.Threa d.sleep for a few milliseconds, or call Application.DoE vents.
    The latter will open your UI to other interaction you may not want however - unless you disable anything that can cause your program to run amok...

    Des

    Comment

    Working...