动态往 datagridview 追加行、列操作

DataGridViewTextBoxColumn acCode = new DataGridViewTextBoxColumn();
acCode.Name = "acCode";
acCode.DataPropertyName = "acCode";
acCode.HeaderText = "A/C Code";
dgvVouchers.Columns.Add(acCode);
//添加列
int index = this.FG1.Rows.Add();
                 this.FG1.Rows[index].Cells[0].Value = TabQR_Code.Rows[0][0].ToString();
                 this.FG1.Rows[index].Cells[1].Value = TabQR_Code.Rows[0][1].ToString();
                 this.FG1.Rows[index].Cells[2].Value = TabQR_Code.Rows[0][2].ToString();
                 this.FG1.Rows[index].Cells[3].Value = TabQR_Code.Rows[0][3].ToString();
                 this.FG1.Rows[index].Cells[4].Value = TabQR_Code.Rows[0][4].ToString();
                 this.FG1.Rows[index].Cells[5].Value = TabQR_Code.Rows[0][5].ToString();
                 this.FG1.Rows[index].Cells[6].Value = TabQR_Code.Rows[0][6].ToString();
                 this.FG1.Rows[index].Cells[7].Value = "已使用";
//添加行

  

posted @ 2016-07-19 15:56  人走茶亦凉  阅读(1340)  评论(0编辑  收藏  举报