473,473 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Weird NumericUpDown Problem... probably bug in .NET framework?

Hi all,

I encountered a problem with NumericUpDown yesterday and managed to
reproduce the error with a very easy examle.
I have a Windows Application with only one Form, which contains only one
NumericUpDown control and nothing else.

This is the only code I wrote: (everything else was done with the
designer of Visual Studio).

private void numericUpDown1_ValueChanged(object sender, EventArgs e) {
if (((NumericUpDown)sender).Value == 50) {
MessageBox.Show("50 reached");
}
}

So the only thing I do is showing a messagebox as soon as the value
reaches 50.

When I increase the value of numericUpDown by clicking and holding the
mousebutton down for some seconds as soon as I reach the value 50 my
messagebox pops up (as expected), but then (after clicking ok on the
messagebox) I get a nullreferenceexception in:

Application.Run(new Form1());
This exception is NOT thrown when I try tho increase the value from 49
to 50 via one single mouse click. Just pressing and holding the
mousebutton to increase the value rapidly and "passing" the "critical
value" (50) causes this problem. It must be some timing issue within the
..net framework. Obviously a timer is used to increase the value
repeatedly while the mousebutton is pressed for some seconds.

Does anybody know this issue and how to avoid it?
Regards
Stephan

---------------------------------
Exception Details:

System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
Source="System.Windows.Forms"
StackTrace:
at
System.Windows.Forms.UpDownBase.UpDownButtons.Time rHandler(Object
source, EventArgs args)
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndPr oc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at
System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at
System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32
reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at WindowsApplication1.Program.Main() in C:\Dokumente und
Einstellungen\Administrator\Eigene Dateien\Visual Studio
2005\Projects\WindowsApplication1\WindowsApplicati on1\Program.cs:line 17
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Jul 22 '06 #1
2 2725
When I increase the value of numericUpDown by clicking and holding the
mousebutton down for some seconds as soon as I reach the value 50 my
messagebox pops up (as expected), but then (after clicking ok on the
messagebox) I get a nullreferenceexception in:

Application.Run(new Form1());

This exception is NOT thrown when I try tho increase the value from 49 to
50 via one single mouse click. Just pressing and holding the mousebutton
to increase the value rapidly and "passing" the "critical value" (50)
causes this problem.
I have had similar weirdness happen when I was doing rapid operations on a
DataGridView...

but ONLY IN THE DEBUGGER. Can you reproduce the problem by setting Visual
Studio to "Release" instead of "Debug" and running the .exe externally?

I think the debugger is failing to keep up with some of what goes on in the
controls.
Jul 22 '06 #2
Unfortunately the error even occurs when running the application without
debug symbols compiled in and launching the .exe file externally.

Michael A. Covington schrieb:
>When I increase the value of numericUpDown by clicking and holding the
mousebutton down for some seconds as soon as I reach the value 50 my
messagebox pops up (as expected), but then (after clicking ok on the
messagebox) I get a nullreferenceexception in:

Application.Run(new Form1());

This exception is NOT thrown when I try tho increase the value from 49 to
50 via one single mouse click. Just pressing and holding the mousebutton
to increase the value rapidly and "passing" the "critical value" (50)
causes this problem.

I have had similar weirdness happen when I was doing rapid operations on a
DataGridView...

but ONLY IN THE DEBUGGER. Can you reproduce the problem by setting Visual
Studio to "Release" instead of "Debug" and running the .exe externally?

I think the debugger is failing to keep up with some of what goes on in the
controls.

Jul 22 '06 #3

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

Similar topics

21
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
10
by: Bonj | last post by:
I'm using a number of NumericUpDown controls on my form, which controls printer settings such as number of pages. However I want to override one of the default behaviours of the control, namely...
2
by: bnob | last post by:
It is possible to format the numeric value of the NumericUpDown control For example : display numbers in 2 digits, instead of 1 display 01, 0 -> 00 , 9 -> 09 Any idea -- Ceci est une...
3
by: abc my vclass | last post by:
My win-form have many numericupdown controls to applied. But numericupdown control don't like textbox, text box control can automatic selected text when got focus. Is there any method can let me...
4
by: Avi | last post by:
Hello All, I am using NumericUpDown control. I have set Decimal places property to 3. Problem is that when I programatically assign it a value which has 4 digits after decimal point , it...
4
by: illegal.prime | last post by:
Hey all, I have a NumericUpDown control on a Panel or potentially a Form that have AutoScroll enabled. When the NumericUpDown is active I would like the Form/Panel/whatever not to scroll when I...
5
by: Len Weltman | last post by:
I am trying to pass a NumericUpDown object into a class method using Visual Studio 2005, but the control type is not found in Intellisense and the type declaration is flagged as an error. Here...
2
by: dave | last post by:
Hello: Is there way to find out whether Up or Down button on NumericUpDown was clicked ?
2
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hello experts, I posted a disturbing question in here:...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
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...

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.