I have a UltraNumericEditor:
ultraNumericEditor1.NumericType = NumericType.Double; ultraNumericEditor1.DataFilter = new PercentageDataFilter(); ultraNumericEditor1.MaskInput = "nnn\\%"; ultraNumericEditor1.SpinButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.Always; ultraNumericEditor1.MaxValue = 100; ultraNumericEditor1.FormatString = "##0\\%";
ultraNumericEditor1.NumericType = NumericType.Double;
ultraNumericEditor1.DataFilter = new PercentageDataFilter();
ultraNumericEditor1.MaskInput = "nnn\\%";
ultraNumericEditor1.SpinButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.Always;
ultraNumericEditor1.MaxValue = 100;
ultraNumericEditor1.FormatString = "##0\\%";
When I delete all numbers from the control, that exception is raised from i-don't-know-where, but is not my code, and I don't know how avoid it.
How could I avoid the user introduce values with the keyboard? I only want that the user can modify de value with the spin buttons.
Cheers
Are you sure that the exception is not triggered by your DataFilter (i.e. it's in the call stack somewhere)? I haven't hit this error before, and it's hard to say what's going on just with the information that you provided.
-Matt
Hi, it's vtortola from another computer.
I've copied the datafilter from the KB, and the exception is raised before enter inside it. The exception appears in the entry point of the application (Application.Run(new ClientForm())).
I'm very sure that is not in my code :
Find all "section is empty", Match case, Subfolders, Find Results 1, "Entire Solution" Matching lines: 0 Matching files: 0 Total files searched: 479
And the call stack shows that the exception come from Infragistics, take a look:
Infragistics2.Win.v8.1.dll!Infragistics.Win.UltraWinMaskedEdit.NumberSection.ToDecimal() + 0x7a bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.UltraWinMaskedEdit.NumberSection.CanSpin(bool up = false) + 0x55 bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.UltraWinMaskedEdit.EditInfo.CanSpin(bool up = false) + 0x1f1 bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.EditorWithMaskSpinButtonUIElement.CanSpin(System.Windows.Forms.ScrollButton direction) + 0x47 bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.EditorWithMaskSpinButtonUIElement.PositionChildElements() + 0x1a7 bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.UIElement.VerifyChildElements(Infragistics.Win.ControlUIElementBase controlElement = {Infragistics.Win.UltraWinGrid.UltraGridUIElement}, bool recursive = true) + 0x51 bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.UIElement.VerifyChildElements(Infragistics.Win.ControlUIElementBase controlElement = {Infragistics.Win.UltraWinGrid.UltraGridUIElement}, bool recursive = true) + 0x9a bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.UIElement.VerifyChildElements(bool recursive) + 0x30 bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.UIElement.VerifyChildElements() + 0xa bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.UltraWinMaskedEdit.EditInfo.ScrollDisplayCharIntoView(int index) + 0x86 bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.UltraWinMaskedEdit.EditInfo.CaretPosition.set(int value) + 0x42 bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.UltraWinMaskedEdit.EditInfo.Delete(bool emulateDeleteKey) + 0x173 bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.UltraWinMaskedEdit.EditInfo.PerformAction(Infragistics.Win.UltraWinMaskedEdit.MaskedEditAction actionCode, bool shift, bool control) + 0x633 bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.EditorWithMask.OnOwnerKeyDown(System.Windows.Forms.KeyEventArgs e = {KeyData = RButton | MButton | Back | Space}) + 0x128 bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.EmbeddableEditorBase.ProcessOwnerKeyDown(object sender, System.Windows.Forms.KeyEventArgs e) + 0xc bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.EmbeddableEditorOwnerBase.RaiseKeyDown(System.Windows.Forms.KeyEventArgs e) + 0x17 bytes Infragistics2.Win.UltraWinGrid.v8.1.dll!Infragistics.Win.UltraWinGrid.UltraGrid.ForwardKeyToEditorHelper(System.Windows.Forms.KeyEventArgs e = {KeyData = RButton | MButton | Back | Space}) + 0xd2 bytes Infragistics2.Win.UltraWinGrid.v8.1.dll!Infragistics.Win.UltraWinGrid.UltraGridUIElement.ProcessKeyDown(System.Windows.Forms.KeyEventArgs e = {KeyData = RButton | MButton | Back | Space}) + 0x75 bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.Utilities.ProcessEvent(System.Windows.Forms.Control control = {Infragistics.Win.UltraWinGrid.DKUltraGrid}, Infragistics.Win.ControlUIElementBase.ProcessEvent eventToProcess = KeyDown, System.EventArgs e = {KeyData = RButton | MButton | Back | Space}) + 0x239 bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.UltraControlBase.OnKeyDown(System.Windows.Forms.KeyEventArgs e) + 0x30 bytes System.Windows.Forms.dll!System.Windows.Forms.Control.ProcessKeyEventArgs(ref System.Windows.Forms.Message m = {msg=0x100 (WM_KEYDOWN) hwnd=0x90bac wparam=0x2e lparam=0x1530001 result=0x0}) + 0x4bc bytes System.Windows.Forms.dll!System.Windows.Forms.Control.ProcessKeyMessage(ref System.Windows.Forms.Message m) + 0x31 bytes System.Windows.Forms.dll!System.Windows.Forms.Control.WmKeyChar(ref System.Windows.Forms.Message m = {msg=0x100 (WM_KEYDOWN) hwnd=0x90bac wparam=0x2e lparam=0x1530001 result=0x0}) + 0x12 bytes System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x3ee bytes System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) + 0xd bytes System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x36 bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, int msg = 256, System.IntPtr wparam, System.IntPtr lparam) + 0x5a bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DefWndProc(ref System.Windows.Forms.Message m = {msg=0x100 (WM_KEYDOWN) hwnd=0x90bac wparam=0x2e lparam=0x1530001 result=0x0}) + 0xcc bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x5 bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.EditorWithMask.AccessibleTextManager.AccessibleTextSubclasser.WndProc(ref System.Windows.Forms.Message msg) + 0x43 bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, int msg = 256, System.IntPtr wparam, System.IntPtr lparam) + 0x5a bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DefWndProc(ref System.Windows.Forms.Message m = {msg=0x100 (WM_KEYDOWN) hwnd=0x90bac wparam=0x2e lparam=0x1530001 result=0x0}) + 0xcc bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x5 bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.FormattedLinkLabel.FormattedLinkEditor.AccessibleTextManager.AccessibleTextSubclasser.WndProc(ref System.Windows.Forms.Message msg) + 0x3d bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, int msg = 256, System.IntPtr wparam, System.IntPtr lparam) + 0x5a bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DefWndProc(ref System.Windows.Forms.Message m = {msg=0x100 (WM_KEYDOWN) hwnd=0x90bac wparam=0x2e lparam=0x1530001 result=0x0}) + 0xcc bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x5 bytes Infragistics2.Win.v8.1.dll!Infragistics.Win.FormattedLinkLabel.IMENativeWindowManager.IMENativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x15 bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg = 256, System.IntPtr wparam, System.IntPtr lparam) + 0x57 bytes [Native to Managed Transition] [Managed to Native Transition] System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(int dwComponentID, int reason = -1, int pvLoopData = 0) + 0x2f1 bytes System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason = -1, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.ApplicationContext}) + 0x17d bytes System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) + 0x53 bytes System.Windows.Forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm) + 0x2e bytes > MyApp.exe!DKHost.DKS.Main(string[ args = {Dimensions:[0]}) Line 40 + 0x1a bytes C# [Native to Managed Transition] [Managed to Native Transition] mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[ args) + 0x39 bytes Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() + 0x2b bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x3b bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x81 bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x40 bytes
I don't know how avoid this behavior, could you help me to find a solution?
Cheers.
I'm seeing the same thing. I have an ultranumericeditor inside a ultrapanel on my user control. Inside the initializecomponent() when it calls this.formPanel.ClientArea.PerformLayout(); it raises this exception (several times!). What does it mean?
(version 9.1.20091.2012)
I just tried this out and I couldn't reproduce the issue; you might want to try the latest service release. If you could also just post a simple sample project here, I'd be happy to take a look at it.
I tried the latest service release .. still does it. I also downloaded the source code to it and had a look around. I saw a lot of calls to the ToDecimal() function in the spinbutton code so I turned off the spin buttons.. the exceptions went away!
I think it might have something to do with databinding.. if I make sure the spinbuttons are enabled only after the form is visible, and turn them off before it closes it seems to work without errors:
private void TaskEditor_VisibleChanged(object sender, EventArgs e)
{
if (this.Visible)
if (budgetHoursUltraMaskedEdit.SpinButtonDisplayStyle != SpinButtonDisplayStyle.OnRight)
budgetHoursUltraMaskedEdit.SpinButtonDisplayStyle =
SpinButtonDisplayStyle.OnRight;
if (maximumHoursUltraMaskedEdit.SpinButtonDisplayStyle != SpinButtonDisplayStyle.OnRight)
maximumHoursUltraMaskedEdit.SpinButtonDisplayStyle =
if (warningHoursUltraNumericEditor.SpinButtonDisplayStyle != Infragistics.Win.ButtonDisplayStyle.Always)
warningHoursUltraNumericEditor.SpinButtonDisplayStyle = Infragistics.Win.
ButtonDisplayStyle.Always;
}
else
if (budgetHoursUltraMaskedEdit.SpinButtonDisplayStyle != SpinButtonDisplayStyle.None)
SpinButtonDisplayStyle.None;
if (maximumHoursUltraMaskedEdit.SpinButtonDisplayStyle != SpinButtonDisplayStyle.None)
if (warningHoursUltraNumericEditor.SpinButtonDisplayStyle != Infragistics.Win.ButtonDisplayStyle.Never)
ButtonDisplayStyle.Never;
You still definitely shouldn't have to do something like this simply to prevent the controls from throwing an exception internally if you're not performing any invalid behavior. How are you binding the controls? What is the DataType and the Value when the exception is being thrown?
Thanks I was wondering about that since the first form load seemed to take the longest. Unfortunately, NGen'ing the app isn't possible since it requires administrator permissions on the local PC and I am using ClickOnce. My understanding is it does a separate install per user so I couldn't even have an admin go in and NGen the assemblies. I'll play around a bit and post a new thread if I come up with anything good.
Part of that lag could certainly be related to some exceptions that are handled internally, but another source of lag could be that when the form first loads, .NET needs to JIT compile each of the Infragistics assemblies, which could lead to some delay. One way to test if this is the case is to create a new parent form with no Infragistics controls in it, then have a button that opens your form that does have the controls in it. If there is a delay the first time you show the child form and not the second time, then you could likely assume that most of it comes from the JITing of the assemblies (and subsequently loading them into memory). You can cut down on this by running ngen on the Infragistics assemblies.
Matt, thanks for following up on this. I know the code will run but I was working my way through your postings on speeding up my controls as I am having trouble with a short lag the first time my form opens. One of your reccomendations was to set it to break on all errors and try to get rid of any exceptions.
Sorry about the confusion there, I guess that the point is moot about preventing the user from editing directly.
Regarding the first chance exceptions, these are only hit because you have the Visual Studio debugger set to break on all exceptions, but these exceptions are handled within the Infragistics code and so shouldn't really be affecting your application. I ran the application with the debugger set to break on all exceptions and the only exception I got was the "Section is empty" exception at this point, but looking at the code it seems like in this particular case we should be able to prevent this exception from being thrown internally. I've forwarded this thread to Developer Support so that it can be looked into.
Update: I commented out your datafilter code and I still get the exception.