Well, you're going to have to change the way the ComboBox represents the
data without actually altering the data. If you alter the data, then that
alteration will be propagated across all controls bound to the same
datasource from the same BindingContext.
What you'll probably have to do is not automatically bind the data and
handle movement between the ComboBox and DataSet by hand.
Pete
"kaborka" <ka*****@discussions.microsoft.com> wrote in message
news:D4**********************************@microsof t.com...
Sorry. rowService is of a typed DataRow class generated by the DataSet
Designer. The Designer generates properties for accessing the column
values in the row. rowService.DefaultCourier is the same as
rowService["DefaultCourier"] except the property is typed as Int32 by the
Designer. Likewise, the Designer generates methods for testing nullable
columns: rowService.IsDefaultCourierNull() is the same as
(rowService["DefaultCourier"] == null).
"Pete Davis" wrote:
What is the "rowService" object? What does the "IsDefaultCourierNull()"
method do? It's not part of the framework that I can find. In fact, a
google search on IsDefaultCourierNull returned nothing.
When you provide sample code, please provide some context with which it
makes sense to us.
Pete
"kaborka" <ka*****@discussions.microsoft.com> wrote in message
news:69**********************************@microsof t.com... 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?