Create a Binding Source Filter in Visual Basic
Posted on 2008-10-06
I have a visual basic 2005 form, Form1, with 20+ controls(textboxes, comboboxes) on it, each bound to a column in an ms access table DataPoints. The controls are bound using tableadapter taDataPoints and BindingSource bsDataPoints.
The form also has a BindingNavigator, bnDataPoints. I would like to add a button to the BindingNavigator that will allow the user to filter by the text selected in the active control.
For example; textbox1 is bound to the column DataPointName, the user selects the text "SteamPressure" in textbox1 and clicks the filter button on the Bindingnavigator. I would like the code to build the statement "DataPointName='SteamPressure'", which will be used as the filter in the BindingSource.
Does anyone have any code that can write a Filter statement for the binding source by detecting which column in the table the active control is bound to? I am having trouble picking up the bound-to column from the control.
Any help would be appreciated. Thanks,