Winform datagridview添加行列

添加单列: this.dgv.Columns.Add("状态", "Status");
添加多列: //this.dgv.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
// new System.Windows.Forms.DataGridViewTextBoxColumn(){ HeaderText = "时间", Name = "Time" , Width = 180 },
// new System.Windows.Forms.DataGridViewTextBoxColumn(){ HeaderText = "状态", Name = "Status" , Width = 113 }
//});
添加单行: this.dgv.Rows.Add();
添加多行: this.dgv.Rows.AddRange(new DataGridViewRow[] { new DataGridViewRow(), new DataGridViewRow() });

你可能感兴趣的:(Winform datagridview添加行列)