G
Guest
Dang, default button - sorry for the 'blank' post I just sent. I wanted to
'subscribe' to the format and parse events for a binding for a control on my
form. The binding was set up in the IDE, so I had thought I could do this....
Dim b As Binding = RenewalDateDateTimePicker.DataBindings.Item("Value")
AddHandler b.Format, AddressOf OnRenewalDateBindingFormat
AddHandler b.Parse, AddressOf OnRenewalDateBindingFormat
but, the event handler was never called.
So, I removed the binding from the Ide and did this...
Dim b As Binding = New Binding("Value", SubscriptionBindingSource,
"RenewalDate", True)
AddHandler b.Format, AddressOf OnRenewalDateBindingFormat
AddHandler b.Parse, AddressOf OnRenewalDateBindingFormat
RenewalDateDateTimePicker.DataBindings.Add(b)
And that worked fine. But I discovered that if I changed the order to this...
Dim b As Binding = New Binding("Value", SubscriptionBindingSource,
"RenewalDate", True)
RenewalDateDateTimePicker.DataBindings.Add(b)
AddHandler b.Format, AddressOf OnRenewalDateBindingFormat
AddHandler b.Parse, AddressOf OnRenewalDateBindingFormat
Then the event handler is never called, again. In other words, you don't
seem to be able to add an eventhandler to a binding class event, after the
'binding' has been added to the DataBindings collection for the control. Is
this by design?
'subscribe' to the format and parse events for a binding for a control on my
form. The binding was set up in the IDE, so I had thought I could do this....
Dim b As Binding = RenewalDateDateTimePicker.DataBindings.Item("Value")
AddHandler b.Format, AddressOf OnRenewalDateBindingFormat
AddHandler b.Parse, AddressOf OnRenewalDateBindingFormat
but, the event handler was never called.
So, I removed the binding from the Ide and did this...
Dim b As Binding = New Binding("Value", SubscriptionBindingSource,
"RenewalDate", True)
AddHandler b.Format, AddressOf OnRenewalDateBindingFormat
AddHandler b.Parse, AddressOf OnRenewalDateBindingFormat
RenewalDateDateTimePicker.DataBindings.Add(b)
And that worked fine. But I discovered that if I changed the order to this...
Dim b As Binding = New Binding("Value", SubscriptionBindingSource,
"RenewalDate", True)
RenewalDateDateTimePicker.DataBindings.Add(b)
AddHandler b.Format, AddressOf OnRenewalDateBindingFormat
AddHandler b.Parse, AddressOf OnRenewalDateBindingFormat
Then the event handler is never called, again. In other words, you don't
seem to be able to add an eventhandler to a binding class event, after the
'binding' has been added to the DataBindings collection for the control. Is
this by design?