1: /// <summary>

   2: /// 追加文本到MemoEdit中

   3: /// </summary>

   4: /// <param name="memoEdit"></param>

   5: /// <param name="strText"></param>

   6: public static void AppendTextToMemoEdit(MemoEdit memoEdit, string strText)

   7: {

   8:     try

   9:     {

  10:         memoEdit.Text = memoEdit.Text + "\r\n" + strText;

  11:         memoEdit.SelectionStart = memoEdit.Text.Length;

  12:         memoEdit.ScrollToCaret();

  13:         Application.DoEvents();

  14:     }

  15:     catch

  16:     {

  17:         return;

  18:     }

  19: }

如果是TextBox控件,可以用 TextBox.AppentText()方法。

05-11 17:54