DataGridView 设计

添加行的方式大概有两种:

1、int index=this.dataGridView1.Rows.Add();
this.dataGridView1.Rows[index].Cells[0].Value ="1";
this.dataGridView1.Rows[index].Cells[1].Value ="2";
this.dataGridView1.Rows[index].Cells[2].Value ="监听";
2、DataGridViewRow row= new DataGridViewRow();
DataGridViewTextBoxCell textboxcell= new DataGridViewTextBoxCell();
textboxcell.Value= "aaa";
row.Cells.Add(textboxcell);
DataGridViewComboBoxCell comboxcell= new DataGridViewComboBoxCell();
row.Cells.Add(comboxcell);
dataGridView1.Rows.Add(row);

posted @ 2020-04-13 18:25  James007007  阅读(132)  评论(0)    收藏  举报