After upgrading my project I get an error on some grids after i click a cell and then close the form that the grid is on. I cannot find the cause anywhere. I just single click a cell that is readonly, then close the form with the windows X and the error comes up. A try Catch in the form closing doesnt catch it.
This is critical so please let me know quickly if you have any clue what the problem is.
The error is:
Object reference not set to an instance of an object.
StackTrace: at Infragistics.Win.UltraWinGrid.UltraGridColumn.get_IsFirstVisibleColumnOnLevel()
at Infragistics.Win.UltraWinGrid.UltraGridCell.CalculateCellOverlayRect(UIElement element, Int32 borderWidth, Boolean calculateInvalidRect)
at Infragistics.Win.UltraWinGrid.UltraGridCell.InvalidateElem(UIElement element, Boolean recalcRects)
at Infragistics.Win.UltraWinGrid.GridItemBase.InvalidateItem(RowScrollRegion rsr, ColScrollRegion csr, Boolean recalcRects)
at Infragistics.Win.UltraWinGrid.GridItemBase.InvalidateItem()
at Infragistics.Win.UltraWinGrid.UltraGrid.InvalidateActiveRowCell()
at Infragistics.Win.UltraWinGrid.UltraGrid.OnLostFocus(EventArgs e)
at System.Windows.Forms.Control.WmKillFocus(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
There is also another error I get when trying to open the Designer for the form.
Object of type 'Infragistics.Win.UltraWinGrid.UltraGrid' cannot be converted to type 'Infragistics.Win.UltraWinGrid.UltraGrid'.
Make sure to check in your project references that you don't have any references to both 8.1 and 9.2 versions of infragistics. I don't think that is your problem, but it's something I've had happen to me before. Upgrading has never been fun for me either.
I went though that already. The errors keep coming after this upgrade. I am getting Unable to cast object of type 'Infragistics.Win.UltraWinGrid.UltraGridBand' to type 'Infragistics.Win.UltraWinGrid.UltraGridBand'. as well now.
The one error with the object not set to instance of object does not appear to happen if on FormClosing I shift the focus away from the grid to some other control on the form.