public void Connect(Form1 frma) { frm = frma; try { frm.settext("Connecting"); string ip = frm.textBox1.Text.ToString(); tcpclnt.Connect(ip, 8001); // use the ipaddress as in the server program frm.settext("Connected"); muzes = true; } catch (Exception e) { frm.settext("Error..... " + e.StackTrace); frm.Show(); } }