StrataFrame Forum

Childformdialog-problem

http://forum.strataframe.net/Topic32166.aspx

By Thomas Holste - 7/30/2013

Hi There,

there is a main form in my project, named lkunden with a BO called lkundenBO1. It contains a childformdialog-control set up to work with a child form named lkundneu, which also contains a BO named lkundenBO1. This is how I load the form:



LKundenBO1.Add()

If Me.Childlkunden.ShowDialog() = DialogResult.OK Then

Dim nLkunr As Integer = NextIDBO1.nextid("LKUNDEN") ' Another BO with a function to call a sp to get an incremented value

LKundenBO1.LKUNDENNR = nLkunr

LKundenBO1.KUNDENNR =
Me.nKundennr

If LKundenBO1.Save <> MicroFour.StrataFrame.Data.SaveUndoResult.Success Then

LKundenBO1.Undo(MicroFour.StrataFrame.Business.BusinessUndoType.CurrentRowOnly)

End If

End If



There is a new record added and I can enter values in the child form. When I leave the childform by setting

the dialog result to ok and return to the main-form, the added record is lost. For example just before exiting from the main form I can control the count-property which is still correct but when I check it in the main form after the "showdialog-line", the added record has disappeared.

Has anyboy an idea what is happening there?

Best regards

Thomas
By StrataFrame Team - 7/30/2013

I'm not sure on this one, Thomas.  It looks like there is a setting on the business object that might be undoing or clearing the business object when the child form closes.  I would try adding some event handlers to the business object to see if you can catch what the stack trace is when the DataTable is changing.  Try adding an event to the CurrentDataTableChanged event and put a break point there.  Then maybe BusinessRulesChecked, or BeforeUndo or one of those.  IsDirtyChanged would also be good since that will have to fire when the BO goes back to having no records, it won't be dirty any more.  If you can find out what the stack trace is when it's changing the BO, we can walk backwards to figure out what's clearing it out.
By Thomas Holste - 7/31/2013

Hi Ben,

thank you for your help. I tried a bit further but did not find why the added record got lost so I dropped the childformdialog-control and replaced it by sending the BO as a parameter to the childform and set the BO and Bindings in the onload -event. A little bit more to type but now everything works as wanted.

Best regards

Thomas
By StrataFrame Team - 7/31/2013

I'm glad you got it working.