Richard:
Just a suggestion: you could try to take it the other way. Instead of
trying to programmatically modify the value of the datetime picker and have
it ripple down to the datarow, you could modify the underlying data field,
and let it "ripple up" to the control.
The trick would be getting to the current row. I think that it would go
something like this (haven't tested, this code might need some adjustment or
syntax correction):
// get the databinding object for the value property
Binding theBinding = theDateTimePicker.DataBindings["Value"];
// Get the current row
// if the target is a data row, I _think_ that you are going to get back a
// DataRowView object, but I might be lying.
DataRowView rowView = (DataRowView)theBinding.BindingManagerBase.Current ;
// modify the value
rowView["TheColumnName"] = ANewDateTimeValue;
"Richard" <an*******@discussions.microsoft.com> wrote in message
news:ef****************************@phx.gbl...
Hi,
I have a DateTime picker control on a form. The datetime
picker control is data bound to a column in a DataTable.
Yes I know about bound DateTime pickers and DBNull and
etc. so no troubles with that stuff...
However, as somebody out there probably knows,
programmatically setting the DateTimePicker.Value property
to a new VALUE does NOT in itself constitute a CHANGE to
the DataBinding mechanism {control focus etc. are involved
in the decision to fire change notification}.
Well this is causing me grief! I have a situation where I
MUST programmatically change the DateTimePicker.Value
property and I need the change to ripple down to my
DataRow immediately.
Question: How can I FORCE DataBinding change events to
fire for one or more bound controls on my form?
--Richard