Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
55
UltraComboEditor is using DBNull for its null value?
posted

I have an UltraComboEditor that is databound to a reference property on a single object.  I have the Nullable property set to true on the UltraComboEditor.  When I clear the text of the UltraComboEditor, it tries to set the underlying property value to DBNull instead of null.  I thus get the ArgumentException: "Object of type 'System.DBNull' cannot be converted to type 'YNAB.Data.SubCategory'.".  Is there a way to force the UltraComboEditor to use null instead of DBNull? If not, is there a way that I can tell the underlying code how to convert from DBNull to null?  I tried making a custom TypeConverter, and all tried making an implicit conversion operator, and niether seem to work, although I certainly could be missing something obvious.  

 Many thanks for any help you can offer,

     Taylor

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    Hi Taylor,

    I think what you can do is use the Binding object. This is the object that is returned to you when you call DataBindings.Add on the control. The proprety you are looking for is DataSourceNullValue.

     

Children