private void buttonDelete_Click(object sender, EventArgs e) { try { richTextBoxMessage.Clear(); ResultCode result = ldapHelper.Delete(textBoxDn.Text); if (result == ResultCode.Success) { richTextBoxMessage.AppendText("刪除成功"); } else { richTextBoxMessage.AppendText("刪除失敗"); richTextBoxMessage.AppendText(result.ToString()); } } catch (Exception ex) { richTextBoxMessage.AppendText(ex.ToString()); } finally { richTextBoxMessage.ScrollToCaret(); } }