I've got a comboBox bound to an object in my code. Is there an
event I can hook when the object is updated? I can break on the
"set mydata = value;" but I'm not clever enough to know what
event triggered that call.
On my form I have a comboBox and an numericUpDown (spinbox)
display.
The binding of the spinbox is selected by the comboBox. The
comboBox itself is bound to it's own data element.
The approach I've taken is to look at the comboBox events:
selectedIndexChanged
selectedValueChanged
Leave
Suggestions?
Jamie Risk - 30 Oct 2006 18:00 GMT
I think I found it:
Instead of:
mycomboBox.DataBindings.Add(
new Binding("Text", myList, "Description));
I'll try:
Binding myBinding = new Binding("Text", myList, "Description));
myBinding.Parse +=
new ConvertEventHandler(this.mycomboBox_Binding_Parse);
mycomboBox.DataBindings.Add(myBinding);
> I've got a comboBox bound to an object in my code. Is there an event I
> can hook when the object is updated? I can break on the
[quoted text clipped - 12 lines]
>
> Suggestions?
Bart Mermuys - 30 Oct 2006 18:01 GMT
Hi,
> I've got a comboBox bound to an object in my code. Is there an event I
> can hook when the object is updated? I can break on the
> "set mydata = value;" but I'm not clever enough to know what event
> triggered that call.
Checkout BindingSource.BindingComplete or Binding.BindingComplete, it will
be fired each time the DataSource or the Control is updated, check the
parameters to determine the direction.
eg.:
comboBox.DataBindings["SelectedValue"].BindingComplete+= new
BindingCompleteEventHandler(OnComboBoxBindingComplete);
private void OnComboBoxBindingComplete( object sender,
BindingCompleteEventArgs e)
{
if ( e.BindingCompleteContext ==
BindingCompleteContext.DataSourceUpdate )
{
comboBox cb = (ComboBox)e.Binding.Control;
....
}
}
HTH,
Greetings
> On my form I have a comboBox and an numericUpDown (spinbox) display.
>
[quoted text clipped - 7 lines]
>
> Suggestions?