C
C#6mo ago
Nebula

✅ System Exception cannot figure out why it's happening

Hello, I have several DataViewGrids that I am binding data to. I'm binding objects from inside of the solution to the grid. I had no problems when I was making my first DataTable, however, I am getting the attached error once I added my second table. I have two tables, one that is displaying data from a BindingList of Parts and another that is displaying data from a BindingList of Products. I bound my Parts table with the following
PartsDataTable.DataSource = Inventory.AllParts;
PartsDataTable.DataSource = Inventory.AllParts;
I am attempting to bind my Products table with
ProductsDataTable.DataSource = Inventory.Products;
ProductsDataTable.DataSource = Inventory.Products;
I should clarify that
Inventory
Inventory
is a class containing static BindingList
AllParts
AllParts
and
Products
Products
Both of these are happening in the main.cs (and main form is what is being launched on application start). When attempting to start the application I get the attached error. If I simply delete those few lines my tables populate correctly but after a few times of restarting the application they get re-created and cause the exception. I'm not sure what's going on and why it's only a problem for the Product, not the Parts?
No description
1 Reply
Nebula
NebulaOP6mo ago
I think I fixed it? I removed "Products" as a DataMember from the productBindingSource. I'm not sure if this will last or if another exception will be thrown soon. If someone could still explain what's happening that would be awesome. Ideally, I would like to understand why it happened so I know how to deal with similar things in the future.
Want results from more Discord servers?
Add your server