Closed fralurbe closed 7 years ago
Probably because that event is coming from another thread, and all UI updates must happen on the main thread. See this q for how to update a forms control from another thread.
http://stackoverflow.com/questions/661561/how-to-update-the-gui-from-another-thread-in-c
Thank you. Working now using this code, extracted from your link to stack overflow.
private void Server_DataReceived(object sender, SimpleTCP.Message message) { ModifyText(message.MessageString); }
private void ModifyText(string message) { if (textBoxRecibido.InvokeRequired) { Action a = () => ModifyText(message) ); Invoke(a); } else textBoxReceived.Text = message) ; }
Awesome!
My textbox text doesn't change.
private void Server_DataReceived(object sender, SimpleTCP.Message message) { textBoxReceived.Text = message.MessageString; }