StrataFrame Forum

Problems when Passing Business Object ByRef

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

By Tim Dol - 10/23/2007

I have two related business objects. I have some code to add records to both business objects and when I execute this code within a form, the code runs fine and the records are added properly.

I needed the ability to share this logic with other programs so I moved my logic to the parent business object class and pass the child business object ByRef.  When I execute the code, I get an error creating a new row on the child BO.  (System.IndexOutOfRangeException). Index 0 is either negative or above rows count.

It seems to execute the NewRow fine and it actually sets the Fk value correctly on the child record but as soon as I try to assign something to any other field it errors out.

Any Idea's??

Thanks

Tim

By Tim Dol - 10/23/2007

You can ignore this for now.  There were other strange things happening on this form so I created a new form and the problem disappeared. Not sure why, but I can now create new records in the business object without any errors.

Tim

By Trent L. Taylor - 10/24/2007

Hmmm....let us know if this pops back up Smile
By Tim Dol - 10/31/2007

Trent,

This same issue has popped up in another piece of code. We tried building a sample application to replicate for you, but of course it works fine in the sample code.  I sent you any email requesting a remote session so we can show you the problem. It's kind of holding us back from finishing an important project so I would appreciate a few minutes of your time to show you the issue.

Thanks,
Tim

By Tim Dol - 11/2/2007

We were finally able to recreate the problem in a test project.  I emailed you guys the test project so you can replicate the index error.

Tim

By StrataFrame Team - 11/5/2007

I think Trent emailed you back the option that states that the BeginLoadData() prevents the DefaultView from being updated and the business object uses that view extensively.
By Tim Dol - 11/6/2007

Yes he did. Thanks.

TIm