鸟语天空
DataGridView动态添加行
post by:追风剑情 2014-4-25 22:55
            DataGridViewRow firstRow = dataGridView1.Rows[0];
            dataGridView1.AllowUserToAddRows = false;//不显示带*号的行

              DataGridViewRow row;
            for (int i = 0; i < 10; i++)
            {
                row = firstRow.Clone() as DataGridViewRow;

                row.Cells[0].Value = i;
                row.Cells[1].Value = "tiankt";
                row.Cells[2].Value = "问题";
                row.Cells[3].Value = "答案0";
                row.Cells[4].Value = "答案1";
                row.Cells[5].Value = "答案2";
                row.Cells[6].Value = "答案3";
                row.Cells[7].Value = "正确答案";
                row.Cells[8].Value = i;

                dataGridView1.Rows.Add(row);
            }
dataview.png

 

 

评论:
发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容