.net - Form locks up on close when background thread accesses textbox -


a background thread needs update label on form. generates event. event handler looks this

    void showresults(object sender,eventargs e)     {         ....         settext( results.tostring() );     }     delegate void settextcallback(string text);     private void settext(string text)     {          if (this.resultslabel.invokerequired)          {             settextcallback d = new settextcallback(settext);             this.invoke(d, new object[] { text });          }          else          {              this.resultslabel.text = text;          }     } 

the label being updated , seems working. problem when close form ui locks up. if comment out statement

settext( results.tostring() ); 

then form closes correctly. how close down properly?


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -