[Mono-bugs] [Bug 78804][Maj] New - Form.Controls.Clear() doesn't work

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Jul 10 08:46:15 EDT 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by kuba.brecka at gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=78804

--- shadow/78804	2006-07-10 08:46:14.000000000 -0400
+++ shadow/78804.tmp.16649	2006-07-10 08:46:15.000000000 -0400
@@ -0,0 +1,63 @@
+Bug#: 78804
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: Windows XP
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: Windows.Forms
+AssignedTo: peter at novonyx.com                            
+ReportedBy: kuba.brecka at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Form.Controls.Clear() doesn't work
+
+Description of Problem:
+Using mono 1.1.16, Windows XP SP1, the following code does not work (and it
+does using MS.NET). Apparently Form.Controls.Clear() does not do anything.
+When you call the Clear() method right after Add(), it works, but when it's
+called from a button's Click event, it doesn't.
+
+Reproduce code:
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+using System.Drawing;
+
+namespace MonoTest10
+{
+    class Form1 : Form
+    {
+        static void Main()
+        {
+            Application.Run(new Form1());
+        }
+
+        public Form1()
+        {
+            Label L = new Label();
+            L.Text = "hello";
+            this.Controls.Add(L);
+
+            Button B = new Button();
+            B.Top = 150;
+            B.Click += new EventHandler(B_Click);
+            this.Controls.Add(B);
+        }
+
+        void B_Click(object sender, EventArgs e)
+        {
+            this.Controls.Clear();
+        }
+    }
+}
+
+Actual Results:
+When clicking the button, nothing happens.
+
+Expected Results:
+Both the button and the label should disappear.


More information about the mono-bugs mailing list