A console app and a WinForms app are not the same, and the way they work is very, very different: In a console app you can code "do this, then this, then that" (as you have done) but in a WinForms app you have to work within the structure of a Windows application. Which means you don't just say "do this, then that", you react to events and do something then.
We can't tell exactly what you have done wrong when you converted it, but I'm guessing that you just lifted that code, dropped it in and tried to replace Console.Read and Console.Write with textboxes. That doesn't work: you need to redesign the whole app to work with Sockets using the event they provide.
This may help:
https://msdn.microsoft.com/en-us/library/538f44zk(v=vs.80).aspx[
^] - it's pretty old, but it's a starting point.