开发者

DataSet binding problem

I've got in-memory dataset with some table defined and I populate this table in a following way:

for(...)
    ds.Fields.AddFieldsRow(++j, 0, heading, "Char", "", "", "Input", 0, "","","");

On the GUI I've got DataGridView bound to that table inside TabControl (bound through BindingSource).

Very strange thing is happening: if I open tab pane with this grid and populate table with some data then I see changes in grid. On the other side if I'm at othe开发者_StackOverflow中文版r tab, populate table, and then switch to tab with grid I've got following exception: "DataMember property 'Fields' cannot be found on the DataSource".

In similar way I've got 2 tab panes with grid in each that are bound to the same datatable using different datasources and I open one of them, populate, see the changes, then switch to second tab and get crash.

What am I missing?


ok, silly me. was clearing dataset tables collection before populating it...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜