private void ConnectThis()
        {
            string pwd = this.txtPwd.Text;

            Credentials creds = null;

            if ((this.txtUser.Text.Length != 0) && (pwd.Length != 0))
            {
                creds = new Credentials(this.txtForest.Text, this.txtDomain.Text, this.txtUser.Text, ref pwd);

                if (creds.HasError)
                {
                    DialogResult ret = MessageBox.Show("Credential error", creds.ErrorMsg, MessageBoxButtons.RetryCancel);

                    if (ret == DialogResult.Cancel)
                    {
                        Unload();
                    }
                }
            }

            else
            {
                creds = new Credentials(this.txtForest.Text, this.txtDomain.Text, this.txtUser.Text, ref pwd);
            }

            GlobalEventHandler.RaiseConnectionSignaled(creds);
        }
 private void Connection_FormClosing(object sender, FormClosingEventArgs e)
 {
     GlobalEventHandler.RaiseConnectionSignaled(null);
 }