[bugfix: 664695] Calling Dispose on ToolStrip emit events. Doesn't on .NET
authorMiguel de Icaza <miguel@gnome.org>
Thu, 10 Feb 2011 23:54:13 +0000 (18:54 -0500)
committerMiguel de Icaza <miguel@gnome.org>
Thu, 10 Feb 2011 23:55:50 +0000 (18:55 -0500)
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs

index f77f6c1f9f1b4b7fdcd86b14ba9ec612107dd0e4..ebf99667a65ad78c47f0c4b8a6b549800f0192cb 100644 (file)
@@ -2221,7 +2221,10 @@ namespace System.Windows.Forms {
                                                return true;
                                        }
                                        else if (accept_button != null) {
-                                               accept_button.PerformClick();
+                                               // Set ActiveControl to force any Validation to take place.
+                                               ActiveControl = (accept_button as Control);
+                                               if (ActiveControl == accept_button) // else Validation failed
+                                                       accept_button.PerformClick();
                                                return true;
                                        }
                                } else if (keyData == Keys.Escape && cancel_button != null) {