dataGridView1.Rows[0].Cells[0].Value = textBox1.Text.ToString();
dataGridView1.Rows[0].Cells[1].Value = textBox3.Text.ToString();
dataGridView1.Rows[0].Cells[2].Value = textBox5.Text.ToString();
dataGridView1.Rows[0].Cells[3].Value = textBox6.Text.ToString();
string[] row = new string[]
{
dataGridView1.Rows[0].Cells[0].Value.ToString(),
dataGridView1.Rows[0].Cells[1].Value.ToString(),
dataGridView1.Rows[0].Cells[2].Value.ToString(),
dataGridView1.Rows[0].Cells[3].Value.ToString(),
};
dataGridView1.Rows.Add(row);
这是代码运行后,产生结果,新输入数据会显示两行,再次输入两行变一行,新输入者还是两行,不知道问题在那边,跪求真因
dataGridView1.Rows[0].Cells[1].Value = textBox3.Text.ToString();
dataGridView1.Rows[0].Cells[2].Value = textBox5.Text.ToString();
dataGridView1.Rows[0].Cells[3].Value = textBox6.Text.ToString();
string[] row = new string[]
{
dataGridView1.Rows[0].Cells[0].Value.ToString(),
dataGridView1.Rows[0].Cells[1].Value.ToString(),
dataGridView1.Rows[0].Cells[2].Value.ToString(),
dataGridView1.Rows[0].Cells[3].Value.ToString(),
};
dataGridView1.Rows.Add(row);
这是代码运行后,产生结果,新输入数据会显示两行,再次输入两行变一行,新输入者还是两行,不知道问题在那边,跪求真因
dataGridView1.Rows.Add(row);
dataGridView1.Rows[index].Cells[0].Value = textBox1.Text.ToString();
dataGridView1.Rows[index].Cells[1].Value = textBox2.Text.ToString();
dataGridView1.Rows[index].Cells[2].Value = textBox3.Text.ToString();
dataGridView1.Rows[index].Cells[3].Value = textBox4.Text.ToString();