private void buttonConnect_Click(object sender, EventArgs e) { disableControls(); bool errors = false; // check values if (this.textBoxHost.Text == "") { errors = true; this.textBoxHost.Text = "[You must enter a hostname]"; } if (this.textBoxUsername.Text == "") { errors = true; this.textBoxUsername.Text = "[You must enter a username]"; } if (!errors) { String host = this.textBoxHost.Text.Split('.')[0]; TabPage tp = new TabPage(host); SshConsole sc = new SshConsole(this.textBoxHost.Text, this.textBoxUsername.Text, this.textBoxPassword.Text); bool res = sc.connect(); if (res) { sc.Dock = DockStyle.Fill; tp.Controls.Add(sc); this.frmParent.AddTabPage(tp); this.Close(); } else { this.labelStatus.Text = "* Login failed..."; enableControls(); } } else { enableControls(); } }