I am using a bindingsource in my windows forms application to populate some textboxes etc in my view. Binding works OK but how can I unsubscribe my bindingSource from from my object?
bindingSource.DataSource = new Foo();//OK
bindingSource.DataSource = null;//Not ok
If I try to unbind by setting data = null
I get an exception:
System.ArgumentException : Cannot bind to the property or column Bar on the DataSource. Parameter name: dataMember
I don't want to remove all bindings to my controls (i have a lot) but would like to suspend binding as long as the bindingSource has no data....
I found a workaround like this bindingSource.DataSource = typeof(Foo);
but is this THE way?