G
Guest
I have a WinForm with controls bound to a typed recordset that was generated
by the Dataset Designer. There are several ComboBox controls with their
DataSource bound to different lookup tables. Everything is working fine,
except when I need to handle a null default value in the data record coming
from the database. I want the combo whose SelectedValue is bound to that
field to display the "default" entry in the combo in this case. I tried the
following code:
if (rowService.IsDefaultCourierNull()) rowService.DefaultCourier = 0;
If the branch is taken and the DefaultCourier value is changed, *all* the
bound controls go blank. I've tried placing this statement alternatively
before or after doing the Refresh of the CurrentyManager. No difference.
The following statement, placed *after* the refresh, *does* work:
if (rowService.IsDefaultCourierNull()) cboCourier.SelectedIndex = 0;
I'm new to WinForms, and it seems like there's something fundamental about
binding that I don't understand. What is the correct way to alter values in
the source DataRow when those values are bound to controls? Is changing the
value in the bound control the correct approach?
by the Dataset Designer. There are several ComboBox controls with their
DataSource bound to different lookup tables. Everything is working fine,
except when I need to handle a null default value in the data record coming
from the database. I want the combo whose SelectedValue is bound to that
field to display the "default" entry in the combo in this case. I tried the
following code:
if (rowService.IsDefaultCourierNull()) rowService.DefaultCourier = 0;
If the branch is taken and the DefaultCourier value is changed, *all* the
bound controls go blank. I've tried placing this statement alternatively
before or after doing the Refresh of the CurrentyManager. No difference.
The following statement, placed *after* the refresh, *does* work:
if (rowService.IsDefaultCourierNull()) cboCourier.SelectedIndex = 0;
I'm new to WinForms, and it seems like there's something fundamental about
binding that I don't understand. What is the correct way to alter values in
the source DataRow when those values are bound to controls? Is changing the
value in the bound control the correct approach?