[Mono-bugs] [Bug 79908][Wis] New - DialogResult.None does not prevent form close

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Nov 11 14:56:57 EST 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 kobruleht2 at hot.ee.

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

--- shadow/79908	2006-11-11 14:56:57.000000000 -0500
+++ shadow/79908.tmp.27756	2006-11-11 14:56:57.000000000 -0500
@@ -0,0 +1,131 @@
+Bug#: 79908
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Windows.Forms
+AssignedTo: toshok at ximian.com                            
+ReportedBy: kobruleht2 at hot.ee               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: DialogResult.None does not prevent form close
+
+To reproduce:
+
+1. Run the code in Windows XP with 1.2RC0
+2. Press space bar
+
+Observed:  Form is closed
+
+Expected: Form must remain open.
+
+Code to reproduce:
+
+------------ form1.cs
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace WindowsApplication1
+{
+    public partial class Form1 : Form
+    {
+        public Form1()
+        {
+            InitializeComponent();
+        }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+            this.DialogResult = System.Windows.Forms.DialogResult.None;
+            
+        }
+    }
+}
+
+--- form1.designer.cs
+
+namespace WindowsApplication1
+{
+    partial class Form1
+    {
+        private System.ComponentModel.IContainer components = null;
+
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        private void InitializeComponent()
+        {
+            this.button1 = new System.Windows.Forms.Button();
+            this.SuspendLayout();
+            // 
+            // button1
+            // 
+            this.button1.DialogResult = 
+System.Windows.Forms.DialogResult.OK;
+            this.button1.Location = new System.Drawing.Point(87, 122);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(75, 23);
+            this.button1.TabIndex = 0;
+            this.button1.Text = "button1";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler
+(this.button1_Click);
+            // 
+            // Form1
+            // 
+            this.AcceptButton = this.button1;
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(292, 273);
+            this.Controls.Add(this.button1);
+            this.Name = "Form1";
+            this.Text = "Form1";
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Button button1;
+    }
+}
+
+----- program.cs
+
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+
+namespace WindowsApplication1
+{
+    static class Program
+    {
+        [STAThread]
+        static void Main()
+        {
+            Application.EnableVisualStyles();
+            Application.SetCompatibleTextRenderingDefault(false);
+             new Form1().ShowDialog();
+
+        }
+    }
+}


More information about the mono-bugs mailing list