private void btnConnect_Click(object sender, EventArgs e) { try { client.StartClient(IPAddress.Parse(tbIPAddress.Text), int.Parse(tbPort.Text)); client.SendMessage(new Common.Message(MessageTypes.RegRequest, tbName.Text)); tbName.ReadOnly = true; tbIPAddress.ReadOnly = true; tbPort.ReadOnly = true; tbMessage.ReadOnly = false; btnConnect.Enabled = false; btnDisconnect.Enabled = true; btnSend.Enabled = true; cbMsgToAll.Enabled = true; } catch { MessageBox.Show("Please check entered data or server is not responding!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }