CURRENCYMANAGER

Some controls such as the DataGrid control provide their own forms of navigation. If you bind a DataGrid to a DataSet, it allows the user to examine the DataSet object’s tables, view and edit data, and follow links between the tables. The DataGrid provides its own methods for navigating through the data. For simpler controls, such as the TextBox, which can display only one data value at a time, you must provide some means for the program to navigate through the data source’s records.

A data source manages its position within its data by using a CurrencyManager object. The CurrencyManager supervises the list of Binding objects that bind the data source to controls such as TextBoxes.

NOTE
The name CurrencyManager has nothing to do with money. Here “currency” refers to the current record, not cash.

The following table describes the CurrencyManager object’s most useful properties.

PROPERTY PURPOSE
Bindings A collection of the bindings that the object manages.
Count Returns the number of rows associated with the CurrencyManager.
Current Returns a reference to the current data object (row).
List Returns an object that implements the IList interface that provides the data for the CurrencyManager. For example, if the data source is a DataSet or DataTable, this object is a DataView.
Position Gets or sets the current position within the data. For example, in a DataTable this is the row number.

The CurrencyManager also provides some methods for manipulating ...

Get Visual Basic 2012 Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.