我正在使用Winforms DevExpress,并将DataTable绑定到DataGridView工作正常。我遇到的问题是,我有一些函数将构建一个新的DataTable对象,它与原始数据表单独立,需要替换绑定到DataGridView的原始DataTable。DataGridView数据源不更新
DataTable originalTable = new DataTable("OriginalTable");
//Populate originalTable
myDataGridControl.DataSource = originalTable;
,一切工作正常与上面的代码,但下面的代码创建一个新的DataTable,需要设置为数据源的myDataGridControl。
DataTable newTable = new DataTable("NewTable");
//Populate newTable
//Set newTable as the DataSource for myDataGridControl
myDataGridControl.DataSource = newTable;
我尝试了几个不同的尝试,例如调用RefreshDataSource(),Refresh(),将DataSource设置为null。我还没有得到它的工作。我该怎么做呢?
的winform或WPF? – Aron
winforms ...对不起,不提。 – TheJediCowboy