1、新建一个Form做测试,包含一个DataGridView,DataGridView有三列,分别是学号,姓名,分数表示一个期末考试分数表。
2、双击添加数据按钮,填写添加数据代码://some codeint index = this.dataGridView1.Rows.Add();this.dataGridView1.Rows[index].Cells[0].Value = textBox1.Text;this.dataGridView1.Rows[index].Cells[1].Value = textBox2.Text;this.dataGridView1.Rows[index].Cells[2].Value = textBox3.Text。
3、点击运行,填写数据。
4、点击添加即可添加一行数据。
5、最后看的可以获取行数。
一、创建一个Form测试表单,包括一个DataGridView,它有三列:DataGridView,DataGridView,这三列表示期末考试成绩表
二、点击添加数据按钮,填写添加数据代码://some codeint index = this.dataGridView1.Rows.Add();this.dataGridView1.Rows[index].Cells[0].Value = textBox1.Text;this.dataGridView1.Rows[index].Cells[1].Value = textBox2.Text;this.dataGridView1.Rows[index].Cells[2].Value = textBox3.Text。
三、单击“运行”以填充数据。
四、单击“添加”添加一行数据。
五、可以从最后一个获取行数
本回答被网友采纳