public ChatClient(ConnectionClient connection, Form form)
 {
     InitializeComponent();
     parent = form;
     client = connection;
     messages = new List<string>();
     update = new Thread(Update);
     update.Start();
 }
 private void buttonLogin_Click(object sender, EventArgs e)
 {
     string host = ipHostBox.Text;
     int port = -1;
     ToolStripItem label = statusBar.Items[0];
     label.Text = "Connecting...";
     int definedPort = Program.Port;
     if (portHostBox.Text != "")
     {
         Int32.TryParse(portHostBox.Text, out definedPort);
     }
     ConnectionClient client = new ConnectionClient(host, definedPort);
     if(client.IsFail)
     {
         label.Text = "Server is Fail!!";
     }
     else
     {
         Form form = new ChatClient(client, this);
         form.Show();
         Visible = false;
     }
 }