* Binding.cs: Don't avoid the Format event if the control
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / Binding.cs
index 138624cda93a761e0d07f03605d1ca9f2e3bc08e..653e3fecfc595a513a00b12db41a7a7f2fa195c8 100644 (file)
@@ -296,15 +296,15 @@ namespace System.Windows.Forms {
 
                private object FormatData (object data)
                {
-                       if (data_type == typeof (object)) 
-                               return data;
-
                        ConvertEventArgs e = new ConvertEventArgs (data, data_type);
 
                        OnFormat (e);
                        if (data_type.IsInstanceOfType (e.Value))
                                return e.Value;
 
+                       if (e.Value == null && data_type == typeof (object))
+                               return Convert.DBNull;
+
                        return ConvertData (data, data_type);
                }