Thread problem
-
I seem to be having a problem with threads. I have modified the main function, so that i can run one application first, then when it disposes itself it will jump to the next line in the main function and finally i run the second application. I get errors with window handlers and controls not showing any graphics although i have invoked them. Am i missing something important here? [STAThread] static void Main() { try { Client c = new Client(); GameClient g; Application.Run(c); while(!SHUTDOWN) { if (!SHUTDOWN) { g = new GameClient(c.connection.Socket,c.connection.Username,c.connection.Table,c.connection.Users); Application.Run(g); Thread.Sleep(1000); //c = new Client(); //c = new Client(c.connection.Socket,c.connection.User); //Application.Run(c); SHUTDOWN = true; } } } catch(Exception ex) { MessageBox.Show("Client.Main " + ex.Message); } }