• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 393
  • Last Modified:

Binding a BindingManagerBase to a dataview


I am using a Dataview to filter rows of data from a table in MSDE.
My controls are placed on a Windows form, contain a datagrid, textboxes and  naviagation buttons (btnNext, btnPrevious..)
I use a BindingManagerBase for navigation.

My problem is this: When I filter the Dataview, the filtered rows are dispalyed in the datagrid, but the textboxes remain unchanged displaying data from the first record in the table, although they are bound to the Dataview. Also the navigation buttons work in the same way before the data was filtered, moving between the first and last record in the table.

What I needed was to show the filtered records in the datagrid and to have the navigation buttons only move between the filtered records.

1 Solution
Try this

   Dim FilteredCurrencyManager As CurrencyManager
   FilteredCurrencyManager = Me.BindingContext(<myDataView>)

and then do your navigation with

   FilteredCurrencyManager.Position += 1

   FilteredCurrencyManager.Position -= 1

and so on.

Or, if you prefer, you can simply alter how you declare your current BindingManagerBase from, I assume

   MyBindingManagerBase = Me.BindingContext(<myDataTable>)


   MyBindingManagerBase = Me.BindingContext(<myDataView>)

tariqanis2001Author Commented:
It worked fine. Thanks a million.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now