Set a Record
Listing 2. You can page the current record for a bound data source on a form easily with .NET. Simply access the CurrencyManager for that data source through the BindingContext collection, then set its Position property to the desired value. ![]() private void btnFwd_Click(object sender,System.EventArgs e) { CurrencyManager cm = this.BindingContext[ m_dsAuthors.Tables["Authors"]] as CurrencyManager; if (cm.Position < cm.List.Count) { cm.Position++; } } private void btnBack_Click(object sender,System.EventArgs e) { CurrencyManager cm = this.BindingContext[ m_dsAuthors.Tables["Authors"]] as CurrencyManager; if (cm.Position > 0) { cm.Position--; } } |