How do I change a property of a control several times during a loop in C# -


i'm trying this:

int i; while(true) {     label1.text = i.tostring();     i++;     thread.sleep(500); } 

(in reality i'm trying more complex , makes more sense simple example of problem) i'm expecting text of lable changes each 1/2 seconds..but getting stuck.

thanks you

you can't make gui-thread sleep (because gui wont respond) (and i'm saying though sleeping * a lot *).

consider 1 of following alternatives:

  • running code on separate thread
  • creating timer 500 interval
  • some sort of binding

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -