Hi,
I'm using the UltraWinGrid control v.11.1.
We have a UltraWinGrid in a form with pagination that means we load on it 50 of a queue of 1.000 rows for example (it depends of an amount of files in a directory) and when the user arrives to the bottom part of the grid we add the next 50 registers of the queue. The program is working good if you use the Scroll Wheel of the mouse, the cursor, etc. but when you use the down arrow button it displays an unhandled exception provoked by the grid when the refreshing process starts.
The user navigation selection is selecting all row.
The unhandled error is this one:
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object. at Infragistics.Win.UltraWinGrid.UltraGrid.OnActiveRowChange(UltraGridRow newActiveRow, Boolean scrollIntoView) at Infragistics.Win.UltraWinGrid.UltraGridBase.SetActiveRow(UltraGridRow row, Boolean scrollIntoView) at Infragistics.Win.UltraWinGrid.UltraGridBase.set_ActiveRow(UltraGridRow value) at Infragistics.Win.UltraWinGrid.UltraGridRow.Activate() at Infragistics.Win.UltraWinGrid.UltraGridRow.SetFocusAndActivate(Boolean byMouse, Boolean enterEditMode, Boolean byTabKey) at Infragistics.Win.UltraWinGrid.UltraGridRow.SetFocusAndActivate() at Infragistics.Win.UltraWinGrid.UltraGrid.Infragistics.Win.ISelectionManager.ActivateItem(ISelectableItem item) at Infragistics.Win.SelectionStrategyExtended.ProcessKeyBoardItem(ISelectableItem item, Boolean shift, Boolean control, Boolean forceToggle) at Infragistics.Win.UltraWinGrid.UltraGridLayout.PerformAction(UltraGridAction actionCode, Boolean shiftKeyDown, Boolean ctlKeyDown) at Infragistics.Win.UltraWinGrid.UltraGrid.PerformKeyAction(Enum actionCode, Boolean shiftKeyDown, Boolean ctlKeyDown) at Infragistics.Win.UltraWinGrid.UltraGridUIElement.PerformKeyAction(Enum actionCode, Boolean shiftKeyDown, Boolean ctlKeyDown) at Infragistics.Win.ControlUIElementBase.ProcessKeyDown(Object sender, KeyEventArgs e) at Infragistics.Win.ControlUIElementBase.ProcessKeyDown(KeyEventArgs e) at Infragistics.Win.UltraWinGrid.UltraGridUIElement.ProcessKeyDown(KeyEventArgs e) at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e) at Infragistics.Win.UltraControlBase.OnKeyDown(KeyEventArgs e) at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m) at System.Windows.Forms.Control.ProcessKeyMessage(Message& m) at System.Windows.Forms.Control.WmKeyChar(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)
Right now updating my version is not possible and I also checked the Service Release for my version but in checklist doesn't display if this problem is fixed.
Thanks for the help.
Thank you for posting in our forums.
From the description you have provided, it seems to me that it could be some strange timing issue, where the next rows aren’t loaded when you are scrolling with the keyboard. I assume you are using the UltraDataSource for the LoadOnDemand feature. However I tried to reproduce this in a separate sample and it was working as expected – no exception was thrown while scrolling, both with 11.1 and our latest version 15.1. Please provide me with a sample that reproduces this issue. I will attach my sample so that you can use it as a starting point.
Thank you for your collaboration.
I am looking forward to hearing from you.
Thanks for the quick reply. I tried your solution and I was not able to reproduce the error in your example, with your code works correctly, we are not using the UltraDataSource, we work with DataTable and we assign directly to grid the datatable using the grid.datasource.
I tried more times with my program and I finally fixed it doing the next steps:
Setting the Grid.DataSource to Null/Nothing and assign it again, and keeping the ActiveRow updated with ActiveRow = Selected.Rows(0)
With that now down arrow works correctly.
Do you know if UltraDataSource is able to manage with pagination? We are considering to update our way of showing records to avoid this kind of problems.
Thanks for the assistance!
The UltraDataSource doesn’t have built in support for paging. Its main benefit is that it allows you to use Load On-Demand functionality and only load the data that is currently displayed by the grid. For more information about this feature, please follow this link:
http://help.infragistics.com/Help/Doc/WinForms/2011.2/CLR2.0/html/WinDataSource_Load_Data_on_Demand.html
And here you can find other useful tutorials about this component:
http://help.infragistics.com/Doc/WinForms/current/CLR4.0/?page=Win_WinDataSource_Using_WinDataSource.html
Please let me know if you have any additional questions.