How can I programmatically move through a dataset that has bound controls?

Platform: WinForms| Category: Data Binding

You have to access a property called the Binding Context and then retrieve the BindingContext associated with the dataset and data member that you used for binding. After you have access to this object you just set the position property. You can move backward and forward through the dataset.

Download a working sample that shows this: simpledata5.zip


form.BindingContext[this.dataSet, ''Customers''].Position -= 1;

Remember that when you scroll through the dataset all associated controls will scroll since they all depend on the same context. This is useful if you want to have several controls that display sections of a row operate in tandem.

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.