c# GUI changing a listbox from another class
Posted
by SlowForce
on Stack Overflow
See other posts from Stack Overflow
or by SlowForce
Published on 2010-03-27T11:49:43Z
Indexed on
2010/03/27
11:53 UTC
Read the original article
Hit count: 229
I've written a multithreaded server that uses tcplistener and a client handler class that controls input and output. I also have a GUI chat client. The chat client works fine and the console version of the server also works well.
I have a start() method in the partial(?) Form class, which I run from a new thread when I click a button, that starts the TCP Listener and loops through and accepts socket requests. For every request a new ClientHandler object is created and the socket is passed to this object before being used in a new handler thread.
The ClientHandler is a different class to the form and I'm having real problems writing data to the Listbox in the Form class from within the ClientHandler class. I've tried a few different ways of doing this but none of them work as they involve creating a new form class within the ClientHandler.
Any help or advice on what I should be reading to help me would be really appreciated.
© Stack Overflow or respective owner