Data structure to use in this situation

cheech306

New member
Joined
Jun 22, 2017
Messages
2
Programming Experience
5-10
Hi all,

I have a system where certain settings in my game will change/update the next set of options. For example, I have several dropdown lists and based on the select of the first dropdown list, the second and third will have to be updated. With more than 2 dropdown lists this can get kind of messy. I was wondering if there were any data structures to handle this type of situation.

Thanks!
 
The easiest option is probably a DataSet. What you describe is basically the same situation as multiple related tables in a database, which is basically what a DataSet represents. You could start with a Parent DataTable in the DataSet with a ParentId column and a ParentName column. You can then have a Child table in the DataSet with ChildId, ChildName and ParentId columns. When you select a Parent by ParentName, you can then get all the Child records with the same ParentId. You can use the same type of relationship through as many levels as you want. If you use BindingSources, you can even have the filtering happen automatically. Here's one I prepared earlier:

Master/Detail (Parent/Child) Data-binding
 
Thank you for this solution!

The easiest option is probably a DataSet. What you describe is basically the same situation as multiple related tables in a database, which is basically what a DataSet represents. You could start with a Parent DataTable in the DataSet with a ParentId column and a ParentName column. You can then have a Child table in the DataSet with ChildId, ChildName and ParentId columns. When you select a Parent by ParentName, you can then get all the Child records with the same ParentId. You can use the same type of relationship through as many levels as you want. If you use BindingSources, you can even have the filtering happen automatically. Here's one I prepared earlier:

Master/Detail (Parent/Child) Data-binding
 
Back
Top Bottom