G
Guest
Hello,
I have a situation that I wish some help with. I have a DataSet object with DataTables populated from a ms access database. Each DataTable has a RunLogTitle. I have a TreeView object with TreeNodes that correspods to the Names of each DataTable's RunLogTitle. When the user clicks on a TreeNode the corresponding DataTable shows up in the DataGrid.
This is working great, but I would want to use a DataView object to show only the components of each DataTable in the DataGrid. I am using a DataGridTableStyle object to then create DataGridColumnStyles.
Here is the problem, in the DataGridTableStyle I have set the MappingName to a DataView object that I have created in the constructor, here is the code that appears in the constructor of the class:
this.myDataView = new DataView(new DataTable);
this.MyDataView.Table.TableName = "MyDataView";
When the form opens up, the DataGrid is populated with the appropriate DataView and the appropriate DataGridColumnStyles only showing the data I wish to show up. HOwever when I click on a different TreeNode, I get an error message stating that "MyDataView" already belongs to the DataSet.
I have been going nuts on trying to solve this, how can I set the DataView to show the other DataTale without getting this message? This is the best way that I can describe this problem, if anyone out there can help me with this I'll greatly appreicate it!
thanks,
ed
I have a situation that I wish some help with. I have a DataSet object with DataTables populated from a ms access database. Each DataTable has a RunLogTitle. I have a TreeView object with TreeNodes that correspods to the Names of each DataTable's RunLogTitle. When the user clicks on a TreeNode the corresponding DataTable shows up in the DataGrid.
This is working great, but I would want to use a DataView object to show only the components of each DataTable in the DataGrid. I am using a DataGridTableStyle object to then create DataGridColumnStyles.
Here is the problem, in the DataGridTableStyle I have set the MappingName to a DataView object that I have created in the constructor, here is the code that appears in the constructor of the class:
this.myDataView = new DataView(new DataTable);
this.MyDataView.Table.TableName = "MyDataView";
When the form opens up, the DataGrid is populated with the appropriate DataView and the appropriate DataGridColumnStyles only showing the data I wish to show up. HOwever when I click on a different TreeNode, I get an error message stating that "MyDataView" already belongs to the DataSet.
I have been going nuts on trying to solve this, how can I set the DataView to show the other DataTale without getting this message? This is the best way that I can describe this problem, if anyone out there can help me with this I'll greatly appreicate it!
thanks,
ed