void btnAddByDt1_Click(object sender, EventArgs e) { DateTime startTime = DateTime.Now; DataTable dtSource = AddByDt(); List<ReplyModel> itemList = new List<ReplyModel>(); foreach (DataRow item in dtSource.Rows) { ReplyModel model = new ReplyModel(); model.DataRow = item; model.GroupDispalyText = txtGroupDispalyText.Text; model.GroupValue = txtGroupValue.Text; model.GroupValueIndex = dtSource.Rows.IndexOf(item); itemList.Add(model); } this.panelEx1.Add<ReplyModel>(itemList); richTextBox1.AppendText("总耗时:" + (DateTime.Now - startTime).TotalMilliseconds + "\n"); richTextBox1.ScrollToCaret(); }
void btnInsert_Click(object sender, EventArgs e) { DataRow row = dt.NewRow(); row[0] = dt.Rows.Count; row[1] = " 插入 TTTTTT 生日,TTTT敬请关注" + this.panelEx1.Count; row[2] = dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm"); row[3] = "超级管理员"; dt.Rows.Add(row); ReplyModel item = new ReplyModel(); item.DataRow = row; this.panelEx1.Insert(int.Parse(txtInsertRowIndex.Text), item); }
private void btnAdd_Click(object sender, EventArgs e) { DataRow row = dt.NewRow(); row[0] = dt.Rows.Count; row[1] = " 新增,TTTT" + this.panelEx1.Count; row[2] = dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm"); row[3] = "超级管理员"; dt.Rows.Add(row); ReplyModel item = new ReplyModel(); item.DataRow = row; if (cbxIsGroup.Checked) { item.GroupDispalyText = txtGroupDispalyText.Text; item.GroupValue = txtGroupValue.Text; item.GroupValueIndex = int.Parse(txtGroupValueIndex.Text); } this.panelEx1.Add(item); }