如果行绑定(bind)到数据源(数据表),如何将行添加到datagridview控件?谢谢!

最佳答案

在数据表中添加一行,datagridview将自动更新:

DataTable dt = myDataGridView.DataSource as DataTable;
//Create the new row
DataRow row = dt.NewRow();

//Populate the row with data

//Add the row to data table
dt.Rows.Add(row);

关于c# - 当数据绑定(bind)到数据网格 View 时,如何以编程方式将行添加到数据网格 View ?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18125147/

10-12 12:43
查看更多