Errors adding a new row


Author
Message
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
I've got the grid, businessGindingSource and BO mentioned earlier and a data navbar.



I've got this code in the BO:

private void ResultDefs_SetDefaultValues()

{

this.ResultDefId = Guid.NewGuid();

this.OccurrenceValue = 0;

}



When I click add on the data nav bar I get invalid cast errors in the code below both before and after the SetDefaultValues method is executed. I'm confused.



public System.Int32 OccurrenceValue

{

get

{

return (System.Int32)this.CurrentRow["OccurrenceValue"];

}

set

{

this.CurrentRow["OccurrenceValue"] = value;

}

}

public System.Guid ResultDefId

{

get

{

return (System.Guid)this.CurrentRow["ResultDefId"];

}

set

{

this.CurrentRow["ResultDefId"] = value;

}

}



Please help. Thanks,

Dan
Replies
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
Yes. Same error in the watch window.
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
If you put this in the watch window, what is the value?

this.CurrentTable.Columns["ResultDefId"].DataType

Does it show {System.Guid}?

Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
yes it's system.guid
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
OK, I've found the navigator that is embedded in the DevExp grid and have enabled it. When I click its add button I get a different error in:

Protected Overridable Sub OnListChanged(ByVal e As ListChangedEventArgs)

RaiseEvent ListChanged(Me, e)

End Sub



System.IndexOutOfRangeException was unhandled by user code

Message="Index was outside the bounds of the array."

Source="DevExpress.Data.v6.1"

StackTrace:

at DevExpress.Data.VisibleIndexCollection.AddVisibleDataRows(GroupRowInfo rowInfo)

at DevExpress.Data.VisibleIndexCollection.BuildVisibleIndexesEx(GroupRowInfo groupRow, Boolean expandAll, Boolean expanded)

at DevExpress.Data.VisibleIndexCollection.BuildVisibleIndexesEx(GroupRowInfo groupRow, Boolean expandAll, Boolean expanded)

at DevExpress.Data.VisibleIndexCollection.BuildVisibleIndexes(Int32 visibleCount, Boolean allowNonGroupedList, Boolean expandAll)

at DevExpress.Data.DataController.OnBindingListChangedCore(ListChangedEventArgs e)

at DevExpress.Data.CurrencyDataController.OnBindingListChangedCore(ListChangedEventArgs e)

at DevExpress.Data.DataController.OnBindingListChanged(ListChangedEventArgs e)

at DevExpress.Data.CurrencyDataController.RaiseOnBindingListChanged(ListChangedEventArgs e)

at DevExpress.Data.Helpers.ListDataControllerHelper.OnBindingListChanged(Object sender, ListChangedEventArgs e)

at System.ComponentModel.ListChangedEventHandler.Invoke(Object sender, ListChangedEventArgs e)

at MicroFour.StrataFrame.Business.BusinessBindingSource.OnListChanged(ListChangedEventArgs e)

at MicroFour.StrataFrame.Business.BusinessBindingSource.BusinessObject_CurrentView_ListChanged(Object sender, ListChangedEventArgs e)

at System.ComponentModel.ListChangedEventHandler.Invoke(Object sender, ListChangedEventArgs e)

at System.Data.DataView.OnListChanged(ListChangedEventArgs e)



This exception occurrs 8 times before ResultDefs_SetDefaultValues() is reached.

Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
Please note that this issue is not resolved and that I have been unable to work since last Thursday.
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
I apologize for the slow response, Daniel, Trent and I are both out of town this week. 

I am not sure what is causing your problem.  The row has already been added to the business object's internal DataTable when the ListChanged event is raised, so it should not be throwing an index out of range exception.  Without stepping through your application and checking the counts and the CurrentRowIndex within your business object, and determining what index the grid is attempting to access, I am not sure what where the error is coming from. 

I am going to attempt to test the issue on a DevExpress grid and reproduce the problem.

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
I was able to create a sample and run it without error by using the embedded navigator in the DevExpress GridControl.  Something is different about your project... there might be an event handler that you have attached to the grid that is throwing an exception, or there might be some other issue.


Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
This is probably something that I need to discuss with you on the phone. It all started out with 2 grids and 2 bo's with a relationship between them. There were so many bizarre things that happened over the course of the past week that it's a little difficult for me to even reconstruct but the basic issue was trying to add a child record in a setting where the parent-child sync was probably not setup right. I will try to call you tomorrow.



Thanks
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
I'm still out of town, and I won't be flying back until Friday, which will take most of the day, so chances of me making it in to the office before Tuesday (Monday is Labor Day) are slim to none.  We can continue to try and work out the problem over the forum until then, so, if you would post everything you can think of... exceptions, inner exceptions, behaviours, etc. we might be able to get it solved before I make it back into the office.
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
Attachment for phone call
Attachments
DM.zip (139 views, 2.00 MB)
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
Additional for call:



private void boResultSetDefs_Navigated(MicroFour.StrataFrame.Business.NavigatedEventArgs e)

{

Trace.WriteLine(boResultSetDefs.ResultSetId.ToString());

boResultDefs.FillByParentPrimaryKey(boResultSetDefs.ResultSetId);

}





Output:

a5f674f5-9bdb-44b8-a9d3-388757009d76

a5f674f5-9bdb-44b8-a9d3-388757009d76

a5f674f5-9bdb-44b8-a9d3-388757009d76

a5f674f5-9bdb-44b8-a9d3-388757009d76

7613d332-09dd-4fb7-8b01-f5b0374226b9

a5f674f5-9bdb-44b8-a9d3-388757009d76

7613d332-09dd-4fb7-8b01-f5b0374226b9

a5f674f5-9bdb-44b8-a9d3-388757009d76

a5f674f5-9bdb-44b8-a9d3-388757009d76

a5f674f5-9bdb-44b8-a9d3-388757009d76

a5f674f5-9bdb-44b8-a9d3-388757009d76

a5f674f5-9bdb-44b8-a9d3-388757009d76

7613d332-09dd-4fb7-8b01-f5b0374226b9

7613d332-09dd-4fb7-8b01-f5b0374226b9

7613d332-09dd-4fb7-8b01-f5b0374226b9

7613d332-09dd-4fb7-8b01-f5b0374226b9

7613d332-09dd-4fb7-8b01-f5b0374226b9

a5f674f5-9bdb-44b8-a9d3-388757009d76

a5f674f5-9bdb-44b8-a9d3-388757009d76

a5f674f5-9bdb-44b8-a9d3-388757009d76

a5f674f5-9bdb-44b8-a9d3-388757009d76

a5f674f5-9bdb-44b8-a9d3-388757009d76

a5f674f5-9bdb-44b8-a9d3-388757009d76

a5f674f5-9bdb-44b8-a9d3-388757009d76

a5f674f5-9bdb-44b8-a9d3-388757009d76

a5f674f5-9bdb-44b8-a9d3-388757009d76

7613d332-09dd-4fb7-8b01-f5b0374226b9

7613d332-09dd-4fb7-8b01-f5b0374226b9

7613d332-09dd-4fb7-8b01-f5b0374226b9

7613d332-09dd-4fb7-8b01-f5b0374226b9

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Daniel Essin - 19 Years Ago
StrataFrame Team - 19 Years Ago
Daniel Essin - 19 Years Ago
StrataFrame Team - 19 Years Ago
                     Yes. Same error in the watch window.
Daniel Essin - 19 Years Ago
                         If you put this in the watch window, what is the value?...
StrataFrame Team - 19 Years Ago
                             yes it's system.guid
Daniel Essin - 19 Years Ago
                                 OK, I've found the navigator that is embedded in the DevExp grid and...
Daniel Essin - 19 Years Ago
                                     Please note that this issue is not resolved and that I have been...
Daniel Essin - 19 Years Ago
                                     I apologize for the slow response, Daniel, Trent and I are both out of...
StrataFrame Team - 19 Years Ago
                                         I was able to create a sample and run it without error by using the...
StrataFrame Team - 19 Years Ago
                                             This is probably something that I need to discuss with you on the...
Daniel Essin - 19 Years Ago
                                                 I'm still out of town, and I won't be flying back until Friday, which...
StrataFrame Team - 19 Years Ago
                                                     Attachment for phone call
Daniel Essin - 19 Years Ago
                                                         Additional for call:

private void...
Daniel Essin - 19 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search