Following Rocky's suggestion I created an "add" method in my grandchild collection...
public void Add(Guid id) grandchild child = grandchild.NewGrandChild(id); this.Add(child); }
{
if(!(Contains(id))
{
int before = this.Count;
int after = this.Count;
}
when I call the Add methd and check the "before" and "after" all looks ok. "after" = "before" + 1.
but..
private void addGrandChildButton_Click(object sender, EventArgs e)
{
ChildSelect dlg = new ChildSelect();
if(dlg.ShowDialog() == DialogResult.OK)
try
{
_congregation.Speakers[currentIndex].Talks.Add(dlg.id);
int count = _parent.Children[currentIndex].GrandChildren.Count;
}
}
When i check the count here there is no change. It is as if no grandchildren were added.. Does anyone have any idea why, or what the problem could be? thanks, Jason
I havn't been able to find the source of this problem yet. But i didn't uncover another problem that is probably related.
Changes to my Child ojects are not saving. I noticed that when i check my parent oject, the child that i just changed doesn't have the changes that i just made on the UI. But if i look at the child object in the childBindingsource the changes are there. So there seems to be a dissconnect between my parent object and the child binding soure.
I've deleted the child bindingsource and added a new one. Same issue.
Any ideas?
Update :
in order to get this to work i had to add this line of code to my BindUI() method. I shouldn't need it, but it doesn't work without it.
this.chidrenBindingSource.DataSource = _parent.Children;
Copyright (c) Marimer LLC