A simple and fast post on C#, as usual to glue the solution of a problem in a place where I know I can find it in the future.
The currency manager object is both loved and hated by those who usually ask questions in the forums where I use to answer, I found it useful, even though sometimes it seems a little bit tricky in its behaviours.
The ItemChanged event, is raised by the Currency manager each time a bound control in the current context modifies the data bound to one of its properties. To determine which control has updated the data, in the ItemChangedEventArgs we have an Index property. It is a 1 (one) based index, strange for the .Net, anyway, using this index in the Bindings collection of the currency manager, we are able to find out which control modified the data. In the sample code below, if a particular textbox has modified the data, we Update the data on the Database using a Data provider Class.
void mCurMgr_ItemChanged(object sender, ItemChangedEventArgs e)
{
if (mCurMgr.Bindings[e.Index - 1].Control.Name == txtPercentualeCons.Name)
{
mDpScenariAziende.Update();
}
}