[Mono-winforms-list] NumericUpDown event problem

Alexander Olk xenomorph2 at onlinehome.de
Thu Mar 16 12:24:02 EST 2006


First of all, your sample misses some semicolons (using
System.Windows.Forms; Name = "simpletest";).
Second, it is Controls.Add(... and not Control.Add(

And third, no, the event doesn't get called twice.

Cheers
  Alexander Olk

Am Donnerstag, den 16.03.2006, 17:02 +0000 schrieb Paul:
> Hi,
> 
> I have a very simple Winform - it consists on a single NumericUpDown
> button with the ValueChanged event set onto the buttons.
> 
> I'm currently seeing though that the event is being triggered twice. Can
> someone confirm this behaviour so I can enter it into bugzilla?
> 
> using System;
> using System.Drawing;
> using System.Windows.Forms
> 
> class simpletest : Form
> {
>   private NumericUpDown number;
> 
>   public simpletest()
>   {
>      number = new NumericUpDown();
>      number.Location = new Point(12, 12);
>      number.Name = "numberbox";
>      number.Size = new Size(50, 23);
>      number.ValueChanged += new EventHandler(number_ValueChanged);
> 
>      AutoScaleBaseSize = new Size(5, 13);
>      ClientSize = new Size (80, 40);
>      Control.Add(number);
>      Name = "simpletest"
>      Text = "NumericUpDown text";
>   }
> 
>   private void number_ValueChanged(object sender, System.EventArgs e)
>   {
>     Console.WriteLine("Event triggered happily");
>   }
> 
>   public static void Main()
>   {
>     simpletest t = new simpletest();
>     Application.Run(t);
>   }
> }
> 
> You should find that when compiled, the event is called twice instead of
> once. I've only tested this under Mono (compiled from source at 16:00hrs
> GMT), so don't know what will happen under .NET
> 
> TTFN
> 
> Paul
>     
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list



More information about the Mono-winforms-list mailing list