J
John Celmer
Can someone please help me with my code. I have a datasetX with two tables,
tableA and tableB in the datasetX. The tables have a DataRelation named
A_B_Relation. How can I get the BindingManagerBase to be a Currency Manager
so that I can get the current position when there is movement in dataGrid1.
This is my code:
// set up the binding contexts for Master/Detail grids
dataGrid1->DataSource = datasetX;
dataGrid1->DataMember = S"tableA";
dataGrid2->DataSource = datasetX;
dataGrid2->DataMember = S"A_B_Relation";
....
....
// get the current position
BindingManagerBase* manager = Form1::BindingContext->Item[datasetX,
S"tableA"];
DataRowView* view = __try_cast<DataRowView*>(manager->Current); // this
line fails with a Bad Cast exception
The above code produces a BindingManagerBase of type PropertyManager, not a
Currency Manager. How can I get a CurrencyManager that will cast to a
DataRowView of the current position? Please help.
tableA and tableB in the datasetX. The tables have a DataRelation named
A_B_Relation. How can I get the BindingManagerBase to be a Currency Manager
so that I can get the current position when there is movement in dataGrid1.
This is my code:
// set up the binding contexts for Master/Detail grids
dataGrid1->DataSource = datasetX;
dataGrid1->DataMember = S"tableA";
dataGrid2->DataSource = datasetX;
dataGrid2->DataMember = S"A_B_Relation";
....
....
// get the current position
BindingManagerBase* manager = Form1::BindingContext->Item[datasetX,
S"tableA"];
DataRowView* view = __try_cast<DataRowView*>(manager->Current); // this
line fails with a Bad Cast exception
The above code produces a BindingManagerBase of type PropertyManager, not a
Currency Manager. How can I get a CurrencyManager that will cast to a
DataRowView of the current position? Please help.