Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Vfp .net event equivalent
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 8.0
OS:
Vista
Network:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01489449
Message ID:
01489991
Views:
36
>>Here's the code for what that's worth:
>>
>>    Sub BindingFormat() Implements IControlBindingFormat.BindingFormat
>>        Dim B As Binding = Me.DataBindings.Item(0)
>>        AddHandler B.Format, AddressOf BooleanToJaNeen
>>        AddHandler B.Parse, AddressOf JaneenToBoolean
>>    End Sub
>>    Sub BooleanToJaNeen(ByVal sender As Object, ByVal cEvent As ConvertEventArgs)
>>        If cEvent.Value Is System.DBNull.Value Then
>>            cEvent.Value = ""
>>            Exit Sub
>>        End If
>>        cEvent.Value = IIf(cEvent.Value, "Ja", "Neen")
>>    End Sub
>>    Sub JaneenToBoolean(ByVal sender As Object, ByVal cEvent As ConvertEventArgs)
>>        cEvent.Value = IIf(cEvent.Value = "Ja", True, False)
>>    End Sub
>>
>
>I see Bonny has pointed out one possible cause but I get the impression it's a more general problem (i.e. not related to the control not losing focus) ?
>IAC I don't see anything wrong in the code above (assuming that any entry other than "JA" translating to false is the expected behaviour). Bear in mind that it would be normal behaviour for the Format event to fire after the Parse (the data is round-tripped). The fact that it is firing at all seems to indicate something is happening.

Well I traced things, and you're right, the format event seems to be fired after the parse event when I issue the bindingsource.endedit. The problem is that the dataset seems to have the original value, whereas on screen I see the new one before bindingsource.endedit ... and the old one after it (which I understand as the format event applied to the original bindingsource value).

I also checked whether or not the validating event is fired, it definitely is. And the binding.parse event is not fired.

Let me see if I got things straight conceptually. I was hoping to have this base class comboboxJaNeen (Ja= yes, Neen = no, but I guess you had gathered that already). I wanted to use it for fields in the datastore that are defined as booolean. On screen I wanted to represent such fields in my comboboxJaNeen class. I was hoping that the format event would translate the boolean into Ja for true and No for false, which seems to work neatly. By analogy, I was hoping that the Parse event would be fired whenever there is a need to synchronize between what's on screen in the ctl.text property and whatever gets stored in bindingsource's dataset. I understand now the latter happens at validating time, which is fine by me.

Thanks for bearing with me.

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform