c# - Get the bindingsource from a control -


i need way find bindingsource control bound to. example, when textbox1 bound bindingsource1 need function input textbox1 , should return bindingsource1

example

textbox1..databindings.add("text", bindingsource1, "name", true);  private bindingsource getbs(control something) {     return bindingsource control } 

so when calling getbs(textbox1) should return bindingsource1

anyone has idea how ?

actually, bindingsource not found on textbox itself, on specific binding, example "text" binding.

you should able this:

        var source = textbox1.databindings["text"].datasource; 

hope helps


Comments