private void buttonLogin_Click(object sender, EventArgs e) { try { richTextBoxMessage.Clear(); ldapHelper.Login(textBoxAccount.Text, textBoxPassword.Text); richTextBoxMessage.AppendText("登入成功"); } catch (Exception ex) { richTextBoxMessage.AppendText("登入失敗" + Environment.NewLine); richTextBoxMessage.AppendText(ex.ToString()); } finally { richTextBoxMessage.ScrollToCaret(); } }