Ignacio
Wed Jan 21 09:06:20 CST 2004
Hi,
You must have some error, if you do not post your code it's useless.
Ijust did a fast test, I created a form, put a panel, and inside it a
numericupdown, I set the panel as disabled.
also added a button withi this code:
this.numericupdown1.Value = 12;
IT DOES FIRE the event.
Below you will find my full code listing, I left it just as VS generated
it, for you to see it visually.
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
*************************************************** START OF CODE
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication1
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.NumericUpDown numericUpDown1;
private System.Windows.Forms.Button button1;
//private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
#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.panel1 = new System.Windows.Forms.Panel();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.button1 = new System.Windows.Forms.Button();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(
);
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.numericUpDown1);
this.panel1.Enabled = false;
this.panel1.Location = new System.Drawing.Point(64, 104);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(176, 96);
this.panel1.TabIndex = 0;
//
// numericUpDown1
//
this.numericUpDown1.Location = new System.Drawing.Point(48, 32);
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.TabIndex = 0;
this.numericUpDown1.ValueChanged += new
System.EventHandler(this.numericUpDown1_ValueChanged);
//
// button1
//
this.button1.Location = new System.Drawing.Point(200, 48);
this.button1.Name = "button1";
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.button1);
this.Controls.Add(this.panel1);
this.Name = "Form1";
this.Text = "Form1";
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
this.ResumeLayout(false);
}
#endregion
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void numericUpDown1_ValueChanged(object sender, System.EventArgs e)
{
MessageBox.Show("hello");
}
private void button1_Click(object sender, System.EventArgs e)
{
this.numericUpDown1.Value = 12;
}
}
}
*************************************************** END OF CODE
<discussion@discussion.microsoft.com> wrote in message
news:eMvb$sC4DHA.1704@tk2msftngp13.phx.gbl...
> How much of an error can I have when I do a NumericUpDown.Value =
someValue;
> and the subscriber isnt getting it.
>
> Im quite sure Im setting the .Value property and I am subscribed to the
> ValueChanged event.
>
> Could you explain where the error is and no im not giving out this
> production code. Could be an issue with my version installed. I always
> hated mishmashed upgrading scenarios.
>
> In the InitializeComponent() form designer code its clearly subscribed my
> event handler to the event.
>
> When I start the form, its set the panel to enabled = false (from the
> designer property) and I load up the value and set the .Value property,
its
> clearly NOT firing. I set a breakpoint and nope, nada.
>
> I now call the event handler directly after setting the .Value property as
a
> workaround.
>
>
> "Mick Doherty"
> <EXCHANGE#WITH@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> wrote
in
> message news:ual8LpC4DHA.1644@TK2MSFTNGP10.phx.gbl...
> > In fact I just tried it, and I was wrong, the event does fire. There
must
> be
> > an error in your code.
> >
> > <discussion@discussion.microsoft.com> wrote in message
> > news:Ow0yhTC4DHA.1636@TK2MSFTNGP12.phx.gbl...
> > > Is that the desired logical behaviour because I am updating a value ,
> its
> > > logically changed but yet its not notified to all subscribers that its
> > > changed. Doesnt smell right to me.
> > >
> > >
> > >
> > >
> > > "Mick Doherty"
> > > <EXCHANGE#WITH@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]>
wrote
> > in
> > > message news:uIa5aQC4DHA.1428@TK2MSFTNGP12.phx.gbl...
> > > > If the Container is disabled then the control is disabled. Disabled
> > > controls
> > > > normally do not fire events.
> > > >
> > > > <discussion@discussion.microsoft.com> wrote in message
> > > > news:%23RjpxLC4DHA.1868@TK2MSFTNGP10.phx.gbl...
> > > > > Mine is.
> > > > >
> > > > > "Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
> > > > > news:MPG.1a788ce590637c3989f06@msnews.microsoft.com...
> > > > > > <discussion@discussion.microsoft.com> wrote:
> > > > > > > I have the control in a PANEL and its got Panel.Enabled =
false,
> > > then
> > > > > while
> > > > > > > its in the false state I update the NumericUpDown.Value
> property
> > > and
> > > > > its
> > > > > > > not firing. Does it only fire when its in an Enabled
container?
> > > > > >
> > > > > > If you look at the example I posted, it's not in a container at
> all.
> > > > > >
> > > > > > --
> > > > > > Jon Skeet - <skeet@pobox.com>
> > > > > >
http://www.pobox.com/~skeet
> > > > > > If replying to the group, please do not mail me too
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>