Question

Code for binding source:

Component.DataSource = new BindingSource(yourSource, ????);

All the examples that I saw follow this patter, and instead of ????, I always see a null. The Docs say the parameters are data source and data member, but I don't understand what is the purpose of the data member or how to use it.

Was it helpful?

Solution

The DataMember parameter is used when the source contains multiple columns, lists, or tables of data and you need to specify which one is being used. From the MSDN for the DataMember Property:

If the DataSource contains multiple lists (or tables) of data, you should set the DataMember property to the name of one of the sources.

The constructor that you are asking about simply allows you to specify this property at instantiation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top