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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tariqanis2001Author Commented:
It worked fine. Thanks a million.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.