public void SetMemoText(string text) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (ResultsMemoEdit.InvokeRequired) { var d = new SetMemoTextDelegate(SetMemoText); Invoke(d, new object[] { text }); } else { ResultsMemoEdit.Text += Environment.NewLine + text; ResultsMemoEdit.Select(ResultsMemoEdit.Text.Length, ResultsMemoEdit.Text.Length); ResultsMemoEdit.ScrollToCaret(); } }
private void SetText(string text) { ResultsMemoEdit.Text += Environment.NewLine + text; ResultsMemoEdit.SelectionStart = ResultsMemoEdit.Text.Length; ResultsMemoEdit.ScrollToCaret(); }