- As for the previous form, to sort items alphabetically set the Sort properties of
the tblAuthorsBindingSource and tblRecordsBindingSource
components to 'Name ASC'.
- Add handlers for the Click events for buttons:
private
void
firstButton_Click(object
sender, EventArgs
e)
{
tblAuthorsBindingSource.MoveFirst();
}
private
void
prevButton_Click(object
sender, EventArgs
e)
{
tblAuthorsBindingSource.MovePrevious();
}
private
void
nextButton_Click(object
sender, EventArgs
e)
{
tblAuthorsBindingSource.MoveNext();
}
private
void
lastButton_Click(object
sender, EventArgs
e)
{
tblAuthorsBindingSource.MoveLast();
}
- In response for the PositionChange event of the
tblAuthorsBindingSource component, set the filter for the
tblRecordsBindingSource:
private
void
tblAuthorsBindingSource_PositionChanged(object
sender, EventArgs
e)
{
tblRecordsBindingSource.Filter =
"IDAuthor="
+
((DataRowView)tblAuthorsBindingSource.Current)["ID"];
}