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.

Who is Participating?
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.