|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Weird error with NumericUpDownI 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 --------------------------------- 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.TimerHandler(Object source, EventArgs args) at System.Windows.Forms.Timer.OnTick(EventArgs e) at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(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\WindowsApplication1\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.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() |
|||||||||||||||||||||||