❔ Show values from a list in a datagridview getting source from bindingsource
Hello! I have the following problem: I am currently developing a winforms app with a datagridview that takes its information from a bindingsource. In this bindingsource i have multiple objects based on my materials class. Every material have two variables, one for its name and a list for other objects that each material should have. Every material have the same number of objects in this list and they all have the same name. I cant seem to figure out how to do this however.
9 Replies
can you provide some code and screenshots?
or try DataGridView.DataSource=bindingsource.ToList();
Well I think i was rather unclear with what I wrote. I will include some screenshots what will hopefully explain it better. I have this class MaterialModel with represents different materials.
The consumables is a list of consumablemodels, which needs a value, name and unit. Its to string method gives back its value and unit.
My datagridview takes a list of material models which it puts into its bindingsource. I get the following output to it:
For each of these materials (test1, test2, test4) I would like its consumables to appear next to them, but also maintain that it material models since I have implemented the method to remove materials by clicking them and hitting a button. It is connected to a pgsql database which stores the materials and retrieves them
Here is the method that loads all the materials into the list which is later used in the bindingsource
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.