When I add a new row to a data bound wingrid, move to the next row and then move back, I get the following unhandled exception.
This is coming from the Infragistics control and I can't determine why? Any suggestions on how to isolate the problem?
System.NullReferenceException: object reference not set to an instance of an object. at Infragistics.Win.ValueListltemMetrics.DirtyCachedValueListltemSize(valueListitem item) at Infragistics.Win.valueListltemMetrics.OnValueListltemsCollectionContentsChanged(Object sender, valueList changedEventArgs e) at Infragistics.Win.valueList.FireListChanged(valueListchangedEventArgs args) at Infragistics.Win.BindableValueList.OnBindingL.stChanged(Object sender, ListChangedEventArgs e) at System.componentModel.ListChangedEventHandlerInvoke(Object sender, ListChangedEventArgs e) at System.windows.Forms.BindingSource.OnListchanged(listChangedEventArgs e) at System.windows.Forms.BindingSource.InnerList_ListChanged(object sender, ListChangedEventArgs e) at System.Data.Dataview.Onlstchanged(l.istChangedEventArgs e) at System.data.DataView.FinishAddNew(Boolean success) at System.Data.DataRowview.CancelEdit() at Infragistics.Win.UltrawinGrid.UltraGridRow.CancelEdit0 at Infragistics.Win.UltrawinGrid.UltraGrid.onActiveRowcleared(Boolean update) at Infragistics.win.UltrawinGrid.UltraGridBase.SetActiveRow(UltraGridRow row, Boolean scrollinto view) at Infragistics.Win.UltrawinGrid.UltraGridBase.set_ActiveRow(UltraGridRow value) at Infragistics.win.UltrawinGrid.UltraGridRow.Activate0 at Infragistics.win.UltrawinGrid.UttraGridRow.SetFocusAndActivate(Boolean byMouse, Boolean enterfditMode, Boolean byTabKey) at tnfragistics.win.Ultrawin6rid.UltraGridRow.SetFocusAndActivateo at Infragistics.win.UltrawinGrid.UltraGridJnfragtstics.WinJSelectionManag er.Activateltem(lSelectableltem item) at lnfragistics.win.SelectionStrategyExtended.OnMouseDown(ISelectablelt em item MouseMessagelnfo& msginfo, Boolean forceDrag) at Infragistics.win.SelectionStrategyExtended.OnMouseDown(ISelectablelt em item, MouseMessagelnfo& msginfo) at Infragistics.win.SelectionStrategyExtended.OnMouseMessage(ISelectabl eltem item, MouseMessagelnfo& msginfo) at Infragistics.win.C ontrolUiElementBase.P rocessMouseDownHelper(Obje ct sender, MouseEventArgs e) at Infragistics.Win.ControlulElementBase.ProcessMouseDown(object sender, MouseEventArgs e) at lnfragisticswin.Utihties.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e) at Infragistics.win.UltracontrolBase.OnMouseDown(MouseEventArgs e) at System.windows.Forms.control.WmMouseDown(Message& m, MouseButtons buttons 1nt32 clicks) at System.windows.Forms.control.WndProc(Message& m) at System.windows.Forms.Control.Control Nativewindow.OnMessage(Me ssage&m) at System.windows.Forms.controiControlNativeWindow.WndProc(Message&m) at System.windows.Forms.Nativewindow.Callback(IntPtr hwnd, 1nt32 msg, !ntPtr wparam, IntPtr Iparam)
Unfortunately that didn't solve the problem after all. Upon further review I found a UltracomboEditor used on another grid in the same form that uses the BindingSource for the first grid as it's datasource. So I had a grid and an ultraComboEditor bound to the same BindingSource.
I created a new Bindingsource for the UltraComboEditor and that resolved the problem.
Thanks
Thanks Mike,
I had 3 combo UltraComboEditor controls with value lists in use by the grid. All of the valueListItems were added at design time and are not being modified at run time. Some of the items had a DataValue but not a DisplayText. After I ensured that all of the DisplayText fields had a value I was not able to reproduce the error.
This error seems to happen when you have ValueListItems that are inconsistent in the use of DataValue and DisplayText (i.e. some but not all DisplayText is null).
Adding text for all the DisplayText seems to have resolved the problem. Thanks for pointing me in the right direction.
This error is coming from the ValueList. Apparently, when you change rows in the grid, the ValueList is getting a notification that it's bound data has changed. So you must be using a bound Valuelist and somehow, something in the data of the ValueList is changing when you change rows in the grid. Are you binding the ValueList to the same list the grid is bound to?