المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Child list for field xxx cannot be created when using BindingContext.EndCurrrentEdit



C# Programming
08-18-2009, 01:09 PM
My project is large, so I can't remember when I last made any changes to this particular form, which used to work.

To bind the my datasets to the datagridviews I have:
bsUsers.DataSource = dsUsers;
bsUsers.DataMember = "UserList";
dgvUsers.DataSource = bsUsers;
bsRoles.DataSource = dsRoles;
bsRoles.DataMember = "RolesList";
dgvRoles.DataSource = bsRoles;
The grids display the correct data.
At the start of saving changes I have:
Validate();
BindingContext[dsRoles, "RolesList"].EndCurrentEdit();
BindingContext[dsUsers, "UserList"].EndCurrentEdit();
The last line gives the runtime error "Child list for field UserList cannot be created". The previous line (dsRoles) works.

I have copied and pasted "UserList" just to make sure that there are no invisible spelling mistakes.
In the Watch pane I can't find any property for dsUsers where one can check if "UserList" is still correct.