Click here to Skip to main content
15,889,992 members

Comments by Pete_H (Top 1 by date)

Pete_H 6-Jun-14 9:32am View    
The sample syncs the grid's datasource with the selected tab. It's a good approach if you pre-loaded your data sources or if fetching data is fast. It also assumes one definition of a record type (SomeBindableClass) in multiple sources

If you loaded the data after an action is performed on a tab, like a button-click, its just as well to store the data source with the tab using the tabPage.Tag property.

If 'different values' also means different record types and columns that are configured in runtime, you could just store the column collection with the datasource in a KeyValuePair in tabPage.Tag. Honestly though, at that point I would probably abandon using only one dataGridView for creating a new instance on each tab, which can also be done at runtime.