[Mono-winforms-list] NumericUpDown test case (with the right file attached)

jba-mono at optusnet.com.au jba-mono at optusnet.com.au
Sat Jun 11 08:53:19 EDT 2005


Appologies, I sent the wrong file last time (please ignore the last email with the MonthCalendar.cs attached)

Hey guys.

Attached is the simplest NumericUpDown Value bug testcase I can come up with.
Clicking on the test button changes the value from the minimum (1953) to 2004. Running this test case on windows (using MWF on .net framework) it takes 3 clicks of the test button for the value to change in the Numeric up down control. I don't know why this is though.

JBA




-------------- next part --------------
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace NumericUpDownTester
{
		public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.NumericUpDown numericUpDown1;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Label label1;

		private System.ComponentModel.Container components = null;

		public Form1()
		{
			InitializeComponent();
		}

		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
			this.button1 = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
			this.SuspendLayout();
			// 
			// numericUpDown1
			// 
			this.numericUpDown1.Font = this.Font;
			this.numericUpDown1.Location = new System.Drawing.Point(16, 16);
			this.numericUpDown1.Maximum = 9999;
			this.numericUpDown1.Minimum = 1953;
			this.numericUpDown1.Name = "numericUpDown1";
			this.numericUpDown1.ReadOnly = true;
			this.numericUpDown1.TabIndex = 0;
			this.numericUpDown1.Visible = false;
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(160, 16);
			this.button1.Name = "button1";
			this.button1.TabIndex = 1;
			this.button1.Text = "Test";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(32, 72);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(192, 144);
			this.label1.TabIndex = 2;
			this.label1.Text = "label1";
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
			this.ClientSize = new System.Drawing.Size(292, 260);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.numericUpDown1);
			this.Name = "Form1";
			this.Text = "Form1";
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private void button1_Click(object sender, System.EventArgs e) {
			int value_before = (int)this.numericUpDown1.Value;
			this.numericUpDown1.Value = 2004;
			this.numericUpDown1.Visible = true;
			this.label1.Text = "value before: " + value_before + Environment.NewLine + "value after: " + this.numericUpDown1.Value;
		}
	}
}


More information about the Mono-winforms-list mailing list