Grab BindingSource from control

Apr 30 2008 11:12 AM

C#.Net Windows project:

Hello all:

How does one grab the BindingSource from a control? I pass a control into a function and I want to then call BindingSource.EndEdit() on the BindingSource for that control but I can't seem to get to the actual source.

I have tried BindingSource bs = (BindingSource) ctrl.DataBindings[0];
But that causes a conversion error. So how can I get to the BindingSource of this controlm to call the .EndEdit() method?

Thanks!