Hi All,
I have a wingrid which uses a datasource, a column in this datasource has a datatype Boolean. When I change the checked state of one of these cells in my grid and then click off the cell I get an invalid cast exception saying cannot convert from Boolean to CheckState.
What is puzzling me is that this all worked fine up until recently, the only change I made to my code was to use an UltraToolBarsManager to change the view style of my window to Outlook2007. Are there any known issues that may be causing this problem?
Thanks,Denis
Hi Denis,
I can't see how the style could make any different. Can you post the call stack of the error?
Is it possible that this is just a FirstChanceException that is being caught and handled by the grid internally and that you are only seeing it because you have set up the IDE to break on all run-time exceptions?
Hi Mike,
Yes you are right, the error only occurs when running my app in debug mode, release version is fine.
The call stack is as follows...
mscorlib.dll!System.Convert.DefaultToType(System.IConvertible value, System.Type targetType, System.IFormatProvider provider) + 0x4aa bytes mscorlib.dll!bool.System.IConvertible.ToType(System.Type type, System.IFormatProvider provider) + 0x26 bytes mscorlib.dll!System.Convert.ChangeType(object value, System.Type conversionType, System.IFormatProvider provider) + 0x40d bytes Infragistics2.Win.v8.3.dll!Infragistics.Win.ValueConstraint.ValueToDataValue(object valueToConvert = true, System.Type convertToType = {Name = "CheckState" FullName = "System.Windows.Forms.CheckState"}, System.IFormatProvider formatProvider = null, string format = null, Infragistics.Win.ValueConstraint.TypeConverterInfo typeConverterInfo = null) + 0x480 bytes Infragistics2.Win.v8.3.dll!Infragistics.Win.EmbeddableEditorBase.ValueToDataValue(object valueToConvert = true, System.Type convertToType = {Name = "CheckState" FullName = "System.Windows.Forms.CheckState"}, Infragistics.Win.EmbeddableEditorOwnerBase owner = {Infragistics.Win.UltraWinGrid.EmbeddableEditorOwnerInfo}, object ownerContext = {Infragistics.Win.UltraWinGrid.CellUIElement}) + 0x14a bytes Infragistics2.Win.v8.3.dll!Infragistics.Win.CheckEditor.CalculateCheckState(object value = true, Infragistics.Win.CheckEditor editor = {Infragistics.Win.CheckEditor}, Infragistics.Win.EmbeddableEditorOwnerBase owner = {Infragistics.Win.UltraWinGrid.EmbeddableEditorOwnerInfo}, object ownerContext = {Infragistics.Win.UltraWinGrid.CellUIElement}) + 0xc3 bytes Infragistics2.Win.v8.3.dll!Infragistics.Win.CheckEditor.SetEditorValueInternal(object newVal = true) + 0x7e bytes Infragistics2.Win.v8.3.dll!Infragistics.Win.CheckEditor.Value.set(object value = true) + 0xa6 bytes Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridCell.SetValueInternal(object value = true, bool suppressErrorMessagePrompt = false, bool fireInitializeRow = false, bool throwExceptionOnError = false) + 0x99e bytes Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridCell.SetValueInternal(object value = true, bool suppressErrorMessagePrompt = false, bool fireInitializeRow = false) + 0x31 bytes Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridCell.CommitEditValue(ref bool stayInEdit = false, bool fireDataError = true, bool forceDontThrowException = false, bool dontStoreInUndoHistory = false) + 0xa8b bytes Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridCell.CommitEditValue(ref bool stayInEdit = false, bool fireDataError = true, bool forceDontThrowException = false) + 0x31 bytes Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridLayout.OnEditorBeforeExitEditMode(object sender = {Infragistics.Win.CheckEditor}, Infragistics.Win.BeforeExitEditModeEventArgs e = {Infragistics.Win.BeforeExitEditModeEventArgs}) + 0x1d9 bytes Infragistics2.Win.v8.3.dll!Infragistics.Win.EmbeddableEditorBase.OnBeforeExitEditMode(ref bool cancel = false, bool forceExit = false, bool applyChanges = true) + 0x97 bytes Infragistics2.Win.v8.3.dll!Infragistics.Win.CheckEditor.OnBeforeExitEditMode(ref bool cancel = false, bool forceExit = false, bool applyChanges = true) + 0x30 bytes Infragistics2.Win.v8.3.dll!Infragistics.Win.EmbeddableEditorBase.ExitEditMode(bool forceExit = false, bool applyChanges = true) + 0x2cd bytes Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridCell.ExitEditMode(bool cancellingEditOperation = false, bool forceExit = false) + 0x15a bytes Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridCell.ExitEditMode() + 0x23 bytes Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGrid.ClearActiveCell(bool invalidate = false, bool shutdown = false) + 0x58 bytes Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGrid.OnActiveRowCleared(bool update = true) + 0x46 bytes Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridBase.SetActiveRow(Infragistics.Win.UltraWinGrid.UltraGridRow row = {Infragistics.Win.UltraWinGrid.UltraGridRow}, bool scrollIntoView = false) + 0x1fa bytes Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridCell.Activate() + 0x1c5 bytes Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridCell.SetFocusAndActivate(bool byMouse = true, bool enterEditMode = true, bool byTabKey = false) + 0x8e bytes Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridCell.SetFocusAndActivate(bool byMouse = true, bool enterEditMode = true) + 0x30 bytes Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.CellUIElementBase.OnEmbeddableElementMouseDown(object sender = {Infragistics.Win.UltraWinGrid.EmbeddableEditorOwnerInfo}, Infragistics.Win.EmbeddableMouseDownEventArgs e = {Infragistics.Win.EmbeddableMouseDownEventArgs}) + 0x244 bytes Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.GridEmbeddableEditorOwnerInfoBase.OnEditorMouseDown(Infragistics.Win.EmbeddableUIElementBase embeddableElem = {Infragistics.Win.EmbeddableCheckUIElement}, Infragistics.Win.EmbeddableMouseDownEventArgs e = {Infragistics.Win.EmbeddableMouseDownEventArgs}) + 0x117 bytes Infragistics2.Win.v8.3.dll!Infragistics.Win.EmbeddableUIElementBase.RaiseMouseDownEvent(Infragistics.Win.UIElement sender = {Infragistics.Win.CheckEditorCheckBoxUIElement}, System.Windows.Forms.MouseEventArgs mouseArgs = {X = 326 Y = 52 Button = Left}, bool isButton = false) + 0x75 bytes Infragistics2.Win.v8.3.dll!Infragistics.Win.CheckEditorCheckBoxUIElement.OnMouseDown(System.Windows.Forms.MouseEventArgs e = {X = 326 Y = 52 Button = Left}, bool adjustableArea = false, ref Infragistics.Win.UIElement captureMouseForElement = null) + 0x10c bytes Infragistics2.Win.v8.3.dll!Infragistics.Win.ControlUIElementBase.ProcessMouseDownHelper(object sender = {Infragistics.Win.UltraWinGrid.UltraGrid}, System.Windows.Forms.MouseEventArgs e = {X = 326 Y = 52 Button = Left}) + 0x35b bytes Infragistics2.Win.v8.3.dll!Infragistics.Win.ControlUIElementBase.ProcessMouseDown(object sender = {Infragistics.Win.UltraWinGrid.UltraGrid}, System.Windows.Forms.MouseEventArgs e = {X = 326 Y = 52 Button = Left}) + 0x179 bytes Infragistics2.Win.v8.3.dll!Infragistics.Win.Utilities.ProcessEvent(System.Windows.Forms.Control control = {Infragistics.Win.UltraWinGrid.UltraGrid}, Infragistics.Win.ControlUIElementBase.ProcessEvent eventToProcess = MouseDown, System.EventArgs e = {X = 326 Y = 52 Button = Left}) + 0x307 bytes Infragistics2.Win.v8.3.dll!Infragistics.Win.UltraControlBase.OnMouseDown(System.Windows.Forms.MouseEventArgs e = {X = 326 Y = 52 Button = Left}) + 0x2a bytes System.Windows.Forms.dll!System.Windows.Forms.Control.WmMouseDown(ref System.Windows.Forms.Message m, System.Windows.Forms.MouseButtons button, int clicks) + 0xcf bytes System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x86e bytes System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) + 0x10 bytes System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x31 bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, int msg = 513, System.IntPtr wparam, System.IntPtr lparam) + 0x5a bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DefWndProc(ref System.Windows.Forms.Message m = {msg=0x201 (WM_LBUTTONDOWN) hwnd=0x10974 wparam=0x1 lparam=0x340146 result=0x0}) + 0x130 bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x5 bytes Infragistics2.Win.v8.3.dll!Infragistics.Win.EditorWithMask.AccessibleTextManager.AccessibleTextSubclasser.WndProc(ref System.Windows.Forms.Message msg = {msg=0x201 (WM_LBUTTONDOWN) hwnd=0x10974 wparam=0x1 lparam=0x340146 result=0x0}) + 0x8d bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, int msg = 513, System.IntPtr wparam, System.IntPtr lparam) + 0x5a bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DefWndProc(ref System.Windows.Forms.Message m = {msg=0x201 (WM_LBUTTONDOWN) hwnd=0x10974 wparam=0x1 lparam=0x340146 result=0x0}) + 0x130 bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x5 bytes Infragistics2.Win.v8.3.dll!Infragistics.Win.FormattedLinkLabel.FormattedLinkEditor.AccessibleTextManager.AccessibleTextSubclasser.WndProc(ref System.Windows.Forms.Message msg = {msg=0x201 (WM_LBUTTONDOWN) hwnd=0x10974 wparam=0x1 lparam=0x340146 result=0x0}) + 0x80 bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, int msg = 513, System.IntPtr wparam, System.IntPtr lparam) + 0x5a bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DefWndProc(ref System.Windows.Forms.Message m = {msg=0x201 (WM_LBUTTONDOWN) hwnd=0x10974 wparam=0x1 lparam=0x340146 result=0x0}) + 0x130 bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x5 bytes Infragistics2.Win.v8.3.dll!Infragistics.Win.FormattedLinkLabel.IMENativeWindowManager.IMENativeWindow.WndProc(ref System.Windows.Forms.Message m = {msg=0x201 (WM_LBUTTONDOWN) hwnd=0x10974 wparam=0x1 lparam=0x340146 result=0x0}) + 0x3a bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg = 513, 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 = 4, int pvLoopData = 0) + 0x24e bytes System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason = 4, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.Application.ModalApplicationContext}) + 0x177 bytes System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) + 0x61 bytes System.Windows.Forms.dll!System.Windows.Forms.Application.RunDialog(System.Windows.Forms.Form form) + 0x33 bytes System.Windows.Forms.dll!System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window owner) + 0x373 bytes > CTAthena_d.dll!CTAthena::CTDataGrid::PropertyItem_Click(System::Object^ sender = 0x016c85ec, System::EventArgs^ e = 0x01dc4004) Line 644 + 0xb bytes C++
So that means the exception is being caught and handled by the grid and dealt with. So you really don't need to worry about it. You will probably want to set the Visual Studio IDE so that it does not break on all run-time exceptions.