G
Guest
C# VS2003
Hi, I'm trying to use the Binding context object & Currency manager to
navigate through a table.
I've set the databindings for a parent child relationship of a label &
datagrid in the form load. Navigation is via the parent (Family):
// simple bind to label in Form load
lblFamily.DataBindings.Add("Text",dsMaster,"Family.FamilyName");
// complex bind to datagrid. Member is relation object
dgFamilyMembers.DataSource = dsMaster;
dgFamilyMembers.DataMember = "Family.FamilyFamilyMember";
then I instantiate a binding context object & use it to create a currency
manager object. The Currency manager is declared outside the class so to be
able to be used in various navigation buttons:
// Form load
BindingContext bc = new BindingContext();
// Used to nav through Parent relation table
cm = (CurrencyManager)bc[dsMaster,"Family"];
// Click event handler of button
// Increment record by one in click event of next button
cm.Position++;
The first record comes up in the label & datagrid ok & diaplays accordingly
to the one to many relationship on startup, but the currency manager doesn't
increment the records when I use cm.Position++. Thid cm object is declared as
a global object. Why does it not increment the position of the Binding
context?
Any answers would be most appreciated.
Ant
Hi, I'm trying to use the Binding context object & Currency manager to
navigate through a table.
I've set the databindings for a parent child relationship of a label &
datagrid in the form load. Navigation is via the parent (Family):
// simple bind to label in Form load
lblFamily.DataBindings.Add("Text",dsMaster,"Family.FamilyName");
// complex bind to datagrid. Member is relation object
dgFamilyMembers.DataSource = dsMaster;
dgFamilyMembers.DataMember = "Family.FamilyFamilyMember";
then I instantiate a binding context object & use it to create a currency
manager object. The Currency manager is declared outside the class so to be
able to be used in various navigation buttons:
// Form load
BindingContext bc = new BindingContext();
// Used to nav through Parent relation table
cm = (CurrencyManager)bc[dsMaster,"Family"];
// Click event handler of button
// Increment record by one in click event of next button
cm.Position++;
The first record comes up in the label & datagrid ok & diaplays accordingly
to the one to many relationship on startup, but the currency manager doesn't
increment the records when I use cm.Position++. Thid cm object is declared as
a global object. Why does it not increment the position of the Binding
context?
Any answers would be most appreciated.
Ant