private void button_summary_Click(object sender, EventArgs e) { string ColNums = textBox_Cols.Text; char[] separator = { ',' }; //string是以逗号分隔的 string[] AllNum = ColNums.Split(separator); //按照逗号分割 Temp.Clear(); //缓存清空 Result.Clear(); //结果记录清空 Result.Append(Header); foreach (string SingleNum in AllNum) { if (SingleNum != "") { Result.Append(Stat.QuickSummary(MainForm.MainDT, Convert.ToInt32(SingleNum) - 1)); } } MainForm.S.richTextBox1.AppendText(Result.ToString()); Temp.Append(Result); MainForm.S.richTextBox1.Select(); //让RichTextBox获得焦点 MainForm.S.richTextBox1.Select(MainForm.S.richTextBox1.TextLength, 0); //将插入符号置于文本结束处 MainForm.S.richTextBox1.ScrollToCaret(); }