如何在 DataGridView 中添加另一行?
How to add another Row in DataGridView?
如何添加另一行
填满第一行后 [0]?
public void preencherDTG()
{
DTG.Rows.Clear();
for (int i = 0; i < 10; i++)
{
DTG.Rows[0].Cells[0].Value = cbModelo.Text;
DTG.Rows[0].Cells[1].Value = txtPlaca.Text;
DTG.Rows[0].Cells[2].Value = txtTotal.Text;
}
}
也许我认为你应该像下面的代码一样。
object [] values = new object [3];
values [0] = cbModello.Text;
values [1] = txtPlaca.Text;
values [2] = txtTotal.Text;
DTG.Rows.Insert (0,values); // insert at first
如何添加另一行 填满第一行后 [0]?
public void preencherDTG()
{
DTG.Rows.Clear();
for (int i = 0; i < 10; i++)
{
DTG.Rows[0].Cells[0].Value = cbModelo.Text;
DTG.Rows[0].Cells[1].Value = txtPlaca.Text;
DTG.Rows[0].Cells[2].Value = txtTotal.Text;
}
}
也许我认为你应该像下面的代码一样。
object [] values = new object [3];
values [0] = cbModello.Text;
values [1] = txtPlaca.Text;
values [2] = txtTotal.Text;
DTG.Rows.Insert (0,values); // insert at first