Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1233
Unable to update the row: Object reference not set to an instance of an object.
posted

I have a situation where the grid will not allow me to set the activerow.  Every attempt to set the active row results in a messagebox:  Unable to update the row:  Object reference not set to an instance of an object.

I am certain that I have set something incorrectly, but troubleshooting this is very difficult.  I cannot determine why the grid will not accept the active row.  The data is accurate in the grid.

The code below is only for test.  It ensures main thread activity.  The message appears twice, once when the activerow is being set and again during the call to base.OnMouseDown

 

 

 

 

 

 

 

 

 

 

protected override void OnMouseDown(MouseEventArgs e){

 

 

if (InvokeRequired){Invoke(new MouseDownEventHandler(OnMouseDown), new object[] { e });

 

 

return;}

_element =

this.DisplayLayout.UIElement.ElementFromPoint(new Point(e.X, e.Y));

 

 

if (this.ActiveRow == null){

 

 

var currentRow = _element.GetContext(typeof (UltraGridRow)) as UltraGridRow;

 

 

if (currentRow != null){

currentRow.Selected =

true;

 

 

this.ActiveRow = currentRow;}}

 

 

base.OnMouseDown(e);