We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Databindings

I bind my textboxes using the databindings like so: txtCustomer.Databindings.Add (New Bindings ("Text", dsCustomer, "Customer.CustName")) My problem is how to remove the databinding. I know there is a property txtCustomer.Databindings.Remove (.....) but I don't know what should go inside the parameters!!

2 Replies

AD Administrator Syncfusion Team June 22, 2002 06:11 AM UTC

in my form_load i bind all the data to the textbox as such.. dataadapter.fill(dsTest, "Test") txt1.databindings.add(New Bindings ("Text"), dsTest, "Test.TestName") ..... But I have a combo box where the user can select the year of the test they want to view. For example, if they want to view 1997's test scores then the textboxes should show all of that year's test scores. If they change the year to 1998, then the databindings should change accordingly. I know I have to remove the databindings each time they change the combobox value.. but i'm getting an error if i do this: txt1.databindings.remove (New Bindings("Text", dsTest, "Test.TestName")


CB Clay Burch Syncfusion Team June 22, 2002 04:07 PM UTC

When you use the Remove, you want to remove an existing Binding, so you do not want to use txt1.databindings.remove (New Bindings("Text", dsTest, "Test.TestName")) as this creates a new Binding (because you are using the New keyword). Instead, you want to get the existing binding, and pass that as the argument. So, try something like txt1.databindings.remove(txt1.databindings("Text"))

Loader.
Live Chat Icon For mobile
Up arrow icon