Home › Forums › WinForms controls › Xceed Grid for WinForms › How to rebind a DataTable to Xceed.Grid
Hello all, new user here.
In code, I create a table, then bind it to the grid.
DataTable table = new DataTable(“Path”); table.Columns.Add(“ID”, typeof(int)); table.Columns.Add(“Name”, typeof(string)); //…
// Programmatically add rows to table…
This works the first time I call it, but after some data changes in the tool, calling the above code again errors at the SetDataBinding with:
Object reference not set to an instance of an object.
I am using a FixedFooterRow, but otherwise, it’s a rather boring grid.
Imported from legacy forums. Posted by Dustin (had 1014 views)
To fix my problem, all that was needed was to Clear the FixedFooterRows:
dg.FixedFooterRows.Clear(); dg.SetDataBinding(table, null);
It’d be nice if the error was more specific.
Imported from legacy forums. Posted by Dustin (had 749 views)