Thread problem updating Windows Forms control in XNA C#
- by Luis
I'm development a network card game, and for now i've two players connected but there is a problem with one of them, this one can't do anything on the game. Looks that screen was blocked. I'm think that is because a code i used before.
That code is:
if (InvokeRequired)
{
this.Invoke(new MethodInvoker(delegate
{
...
}));
return;
}
The code above is surrounding code to changing Button values, make connection with server and create game window. Without this code a warning is shown.
InvalidOperationException was unhandled
Cross-thread operation not valid: Control 'startGameButton' accessed from a thread other than the thread it was created on.