|
Hi,
Sometimes this type of thing can be a bit confusing, but the only real work you have to do is take the code from your console application, break it up into the proper event handlers and change where some of the output and input goto and come from respectively.
So start by creating a new windows application project. This will generate your GUI style application. Second you will need to take out most of the code statements from the main() method and decide where do you want to establish the listening. Do you want it to start listening when you start the application? If so, you could put this in the form load event. If you want to start listening when you press a button, put it in the onclick event of your button. Third you will have to move any reference to a client connection to higher scope so that you can hold a reference to it for reading and eventually writing. Fourth, you will take out those writing statements and put them into a button that when clicked will read from your richeditbox and write it to the proper client connection. Now writing to the proper client connection (if multiple people are connected to you) can be tricky, but if you moved the scope higher as I suggested, you could build in a list of connection objects and specify which connection much easier. Lastly, where you have any console statements you are going to be directing the output to a richeditbox or some other control.
Try breaking it up into your different handlers and then repost your code listing any errors you get, then we can advise you how to proceed and get the application working.
|