473,569 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ValueChanged event NOT being fired when setting NumericUpDown.V alue property

Hi,

I am setting the NumericUpDown .Value property and the ValueChanged event
is NOT being fired. Does this ONLY get fired when I change it on the UI and
not programatically ?

Thanks
Jul 21 '05 #1
21 9849
<di********@dis cussion.microso ft.com> wrote:
I am setting the NumericUpDown .Value property and the ValueChanged event
is NOT being fired. Does this ONLY get fired when I change it on the UI and
not programatically ?


I'm not seeing the behaviour you've described. For instance:

using System;
using System.Windows. Forms;

class Test
{

static void Main()
{
NumericUpDown nud = new NumericUpDown() ;
nud.ValueChange d += new EventHandler (SayHello);
nud.Value = 20m;
}

static void SayHello (object sender, EventArgs e)
{
Console.WriteLi ne ("Hello");
}
}

displays "Hello" as expected.

Could you produce a similar short but complete program which
demonstrates the problem?

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2
I have the control in a PANEL and its got Panel.Enabled = false, then while
its in the false state I update the NumericUpDown.V alue property and its
not firing. Does it only fire when its in an Enabled container?
"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
<di********@dis cussion.microso ft.com> wrote:
I am setting the NumericUpDown .Value property and the ValueChanged event is NOT being fired. Does this ONLY get fired when I change it on the UI and not programatically ?


I'm not seeing the behaviour you've described. For instance:

using System;
using System.Windows. Forms;

class Test
{

static void Main()
{
NumericUpDown nud = new NumericUpDown() ;
nud.ValueChange d += new EventHandler (SayHello);
nud.Value = 20m;
}

static void SayHello (object sender, EventArgs e)
{
Console.WriteLi ne ("Hello");
}
}

displays "Hello" as expected.

Could you produce a similar short but complete program which
demonstrates the problem?

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Jul 21 '05 #3
<di********@dis cussion.microso ft.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.V alue 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 - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #4
Mine is.

"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** @msnews.microso ft.com...
<di********@dis cussion.microso ft.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.V alue 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 - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Jul 21 '05 #5
<di********@dis cussion.microso ft.com> wrote:
Mine is.


How relevant is that? You asked whether the event only fired when it's
in an Enabled container. I pointed out that my example doesn't use a
container at all, so the answer to your question is clearly "no".

Now, as I said before, the best way of resolving this is for you to
come up with a short but complete program which demonstrates the
problem.

See http://www.pobox.com/~skeet/csharp/complete.html for what I mean by
that.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #6
If the Container is disabled then the control is disabled. Disabled controls
normally do not fire events.

<di********@dis cussion.microso ft.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Mine is.

"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** @msnews.microso ft.com...
<di********@dis cussion.microso ft.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.V alue 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 - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Jul 21 '05 #7
Its very relevant because the event is NOT firing with it in a disabled
container.

"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
<di********@dis cussion.microso ft.com> wrote:
Mine is.


How relevant is that? You asked whether the event only fired when it's
in an Enabled container. I pointed out that my example doesn't use a
container at all, so the answer to your question is clearly "no".

Now, as I said before, the best way of resolving this is for you to
come up with a short but complete program which demonstrates the
problem.

See http://www.pobox.com/~skeet/csharp/complete.html for what I mean by
that.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Jul 21 '05 #8
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"
<EX***********@ AND.REMOVE.SQUA REBRACKETS.[mdaudi100#ntlwo rld.com]> wrote in
message news:uI******** ******@TK2MSFTN GP12.phx.gbl...
If the Container is disabled then the control is disabled. Disabled controls normally do not fire events.

<di********@dis cussion.microso ft.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Mine is.

"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** @msnews.microso ft.com...
<di********@dis cussion.microso ft.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.V alue 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 - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too



Jul 21 '05 #9
As a workaround for this illogical behaviour, I fire the event myself after
i change the property.

Having them NOT fire events when disabled yet theyre still changing doesnt
seem logical at all. In fact I would say its giving incorrect values as the
subscribers think its one value yet its actually NOT that value because its
changed but no event to notify them.
<di********@dis cussion.microso ft.com> wrote in message
news:Ow******** ******@TK2MSFTN GP12.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"
<EX***********@ AND.REMOVE.SQUA REBRACKETS.[mdaudi100#ntlwo rld.com]> wrote in message news:uI******** ******@TK2MSFTN GP12.phx.gbl...
If the Container is disabled then the control is disabled. Disabled

controls
normally do not fire events.

<di********@dis cussion.microso ft.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Mine is.

"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** @msnews.microso ft.com...
> <di********@dis cussion.microso ft.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.V alue 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 - <sk***@pobox.co m>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too



Jul 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
2405
by: | last post by:
Hi, I am setting the NumericUpDown .Value property and the ValueChanged event is NOT being fired. Does this ONLY get fired when I change it on the UI and not programatically? Thanks
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7931
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7682
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7984
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5228
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3663
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2119
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
954
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.