I have 2 datables being added to a dataset:
a parenttable:
Dim ctable As New DataTable("Category")
ctable.Columns.Add("Category", GetType(String))
a childtable:
Dim vtable As New DataTable("ValueTable")
vtable.Columns.Add("Category", GetType(String))
vtable.Columns.Add("Profile", GetType(String))
vtable.Columns.Add("Value", GetType(Double))
added to a dataset and linked via the column "category" using a datarelation:
Dim masterdata As New DataSet()
masterdata.Tables.Add(ctable)
masterdata.Tables.Add(vtable)
Dim dr As DataRelation = New DataRelation("ValueCategory",
ctable.Columns("Category"),
vtable.Columns("Category"), True)
masterdata.Relations.Add(dr)
adding this to a datagridview as datasource like:
aDataGridView.DataSource = masterdata.tables(0)
this will only show the parent table but I was hoping to have expandable rows related to my datarelation, but it wont work. I also tried binding my datasource to a bindingsource with the datasource as my masterdata table and my datamember being my relation, which would make more sense to me, but also this did not work. initially I followed the example below
this is a similar question, but not the same:
Showing parent datatable in one datagridview and show child datatable elements in another?