string[] dgColumns = new string[5] { "序号", "样品名称", "特征", "值", "结果"};
DataTable datatable = new DataTable();
for (int i = 0; i < dgColumns.Length; i++)
{
DataColumn dc = new DataColumn(dgColumns[i], typeof(string));
datatable.Columns.Add(dc);
}
for (int i = 0; i < 2;i++ )
{
DataRow dr = datatable.NewRow();
dr[0] = i + 1;
dr[1] = "样";
dr[2] = "235";
dr[3] = "4500";
dr[4] = "";
datatable.Rows.Add(dr);
}
dataGrid1.DataSource = datatable;
DataGridTableStyle ts = new DataGridTableStyle();
ts.MappingName = datatable.Namespace;
wince 在C#中 对datagrid 的数据添加
最新推荐文章于 2021-06-18 01:32:42 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)