Binding controls to child objects that may be empty

Binding controls to child objects that may be empty

Old forum URL: forums.lhotka.net/forums/t/260.aspx


gmclean posted on Friday, June 02, 2006

I have a windows form bound to a BO with child objects. It is possible that the child objects will have no records in the database. In this case I am having trouble binding a member of the child object to a control.

In the editable root I get the child like:

mChild = ChildBO.GetChild(ID, True)

If there are no corresponding database records I get a child object with string fields that are Nothing. The problem comes when I try to bind the fields in the ChildBO to controls.

Any suggestions on the best way to handle this?

Thanks

George

xal replied on Friday, June 02, 2006

You should always initialize your fields in their declaration. It's a must if you're using databinding.

Andrés

gmclean replied on Monday, June 05, 2006

Thanks Andres - It is always simple once someone points out the answer!

George

Copyright (c) Marimer LLC