http://www.jb51.net/article/72259.htm
Datagridview添加列:
1
2
3
4
5
|
DataGridViewTextBoxColumn acCode = new DataGridViewTextBoxColumn(); acCode.Name = "acCode" ; acCode.DataPropertyName = "acCode" ; acCode.HeaderText = "A/C Code" ; dgvVouchers.Columns.Add(acCode); |
Datagridview创建行:
1
2
3
4
5
6
|
DataGridViewRow dr = new DataGridViewRow(); dr.CreateCells(dgvVouchers); //添加的行作为第一行 dgvVouchers.Rows.Insert(0, dr); //添加的行作为最后一行 dgvVouchers.Rows.Add(dr_new); |