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"))