Hi Flomo,
I performed a test based on your description and did see the same thing as
you did.
We could change the value of type Nullable(of Integer) by assigning a value
of type Integer or Nullable(of Integer) to it directly. It seems that the
problem comes from data binding, which in this case doesn't push the new
value to the data source.
I subscribe and handle the Parse event of the Binding object that is added
to the DataBindings property of the ComboBox control, and find that the new
value being pushed to the data source is of type Integer. The following is
the code to subscribe the Parse event of the Binding object and the code of
the event handler.
AddHandler Me.ComboBox1.DataBindings.Item(0).Parse, AddressOf comboboxParse
Private Sub comboboxParse(ByVal sender As Object, ByVal e As
System.Windows.Forms.ConvertEventArgs)
' e.Value is of type Integer.
Dim obj As Object = e.Value
End Sub
In the Parse event handler, e.Value is of type Integer. Apparently, data
binding couldn't update the property of type Nullable(Of Integer) with the
value of Integer.
The workaround is simple, i.e. changing the property value by assigning the
new value to it directly in the Parse event handler. The following is a
sample.
Private Sub comboboxParse(ByVal sender As Object, ByVal e As
System.Windows.Forms.ConvertEventArgs)
' the obj is a variable refereced to the current object in the data
source
obj = e.Value
End Sub
I have performed a test on the above workaround and confirmed it works.
Hope this helps.
If you have any question, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx. ==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.