You should test for BO.Count > 0 before using any of its properties.
Trinity.BusinessObjects.boPlanParticipant.get_plan_fk() -> this is the code failing, enclose it in the above test and you should be fine.
I got it fixed - thanks for trying to help. And yes, the problem was that my code was trying to access one of the BO's properties and I stupidly missed it
Actually, to be more precise, this is code that was generated by the business object mapper...
This is not my code - it is framework code. I do not have code anywhere that accesses noPlanParticipant - it is just sitting on the form.
The BO that is causing this error is for an allocation table that I am manipulating in code. All I did was drop it on the form - I did not bind it to any controls. Now I can no longer bring the form up because of this error. Any ideas?
BusinessLayerException The CurrentRow for table '[dbo].[planparticipant]' could not be evaluated because the CurrentRowIndex is out of range. Business object record count: 0. CurrentRowIndex: -1.
Source : MicroFour StrataFrame Business
Stack Trace: at MicroFour.StrataFrame.Business.BusinessLayer.get_CurrentRow() at Trinity.BusinessObjects.boPlanParticipant.get_plan_fk() in F:\Trinity_new\Trinity\BusinessObjects\boPlanParticipant.Designer.cs:line 320 at Trinity.Forms.Participants.boParticipants_Navigated(NavigatedEventArgs e) in F:\Trinity_new\Trinity\Forms\Participants.cs:line 83 at MicroFour.StrataFrame.Business.BusinessLayer.NavigatedEventHandler.Invoke(NavigatedEventArgs e) at MicroFour.StrataFrame.Business.BusinessLayer.raise_Navigated(NavigatedEventArgs e) at MicroFour.StrataFrame.Business.BusinessLayer.OnNavigated(NavigatedEventArgs e) at MicroFour.StrataFrame.Business.BusinessLayer.ForceNavigatedAndBoundRefresh(Boolean dataTableRefilled) at MicroFour.StrataFrame.Business.BusinessLayer.OnCurrentDataTableRefilled() at MicroFour.StrataFrame.Business.BusinessLayer.ChangeCurrentDataTable(DataTable NewTable, Boolean AcceptChanges, Boolean IsSharedTable) at MicroFour.StrataFrame.Business.BusinessLayer.ChangeCurrentDataTable(DataTable NewTable, Boolean AcceptChanges) at MicroFour.StrataFrame.Business.BusinessLayer.ChangeCurrentDataTable(DataTable NewTable) at MicroFour.StrataFrame.Business.BusinessLayer.FillDataTable(DbCommand CommandToExecute) at Trinity.BusinessObjects.boParticipants.GetParticipant(Int32 tnParticpant_pk) in F:\Trinity_new\Trinity\BusinessObjects\boParticipants.cs:line 63 at Trinity.Forms.Participants.GetCurrentParticipant(Int32 tnParticipant_pk, Boolean tlPutInEditMode) in F:\Trinity_new\Trinity\Forms\Participants.cs:line 48 at Trinity.Forms.Plans.EditParticipant(Boolean tlPutInEditMode) in F:\Trinity_new\Trinity\Forms\Plans.cs:line 252 at Trinity.Forms.Plans.grdParticipants_DoubleClick(Object sender, EventArgs e) in F:\Trinity_new\Trinity\Forms\Plans.cs:line 302 at System.Windows.Forms.Control.OnDoubleClick(EventArgs e) at System.Windows.Forms.DataGridView.OnDoubleClick(EventArgs e) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.DataGridView.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativewindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativewindow.WndProc(Message& m) at System.Windows.Forms.Nativewindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)