标签:datagridview for new res table ar
if (dt != null)
{
DataGridViewColumn dgvc = null;
this.dataGridView1.DataSource = null;
this.dataGridView1.Columns.Clear();
foreach (DataColumn dc in dt.Columns)
{
dgvc = new DataGridViewColumn();
dgvc.Name = dc.ColumnName;
dgvc.HeaderText = dc.ColumnName;
dgvc.DataPropertyName = dc.ColumnName;
dgvc.CellTemplate = new DataGridViewTextBoxCell();
dgvc.Resizable = DataGridViewTriState.True;
dgvc.SortMode = DataGridViewColumnSortMode.Automatic;
this.dataGridView1.Columns.Add(dgvc);
}
this.dataGridView1.AutoGenerateColumns = false;
this.dataGridView1.DataSource = dt;
}
datagridview 绑定 datatable,布布扣,bubuko.com
标签:datagridview for new res table ar
原文地址:http://www.cnblogs.com/xiguanjiandan/p/3824513.html