How to get all bindingsources on a form

Viewed 807

I have a base form with one BindingSource on it. I have a second form that inherits from the the base form, and this second form has an additional 5 binding sources.

I want to get the list of binding sources that I have in the second form (ie. 6).

So, in the OnLoad of the base form, I first tried:

var list = this.Controls.OfType<BindingSource>();

But I only got the base form's bindingsource. Then I tried:

var List = (from Component bs in this.components.Components
            where bs is BindingSource
            select bs);

Which also returns the same bindingsource.

Doing the above in the OnLoad of the base form should work because I can get all controls of the second form.

However, I cannot seem to get the binding sources of the second form.

So what is the correct way to list them?

1 Answers
Related