Home Forums WinForms controls Xceed Grid for WinForms Error in expanding grid Reply To: Error in expanding grid

User (Old forums)
Member
Post count: 23064

Hi Jenny,

The code and the error message is added at the end of the message.
My main problem is, that I want the gird to expanded when this code is called, but it only seems to be working by calling the collapsechanged event.

This is the code that is called:

//add the inner grids for command attributes, parameters
//and child commands
DetailGrid commandGrid = this.CreateCommandAttributesGrid( command );
this.DetailGridTemplates.Add( commandGrid );
this.FillCommandAttributesGrid( commandGrid );
commandGrid.Collapse();

DetailGrid grid = this.CreateParameterDetailGrid( command );
this.DetailGridTemplates.Add( grid );
this.FillParameterDetailGrid( grid );
this.EndInit();

this.DetailGridTemplates[ 0 ].Expand();
this.DetailGridTemplates[ 1 ].Expand();
this.UpdateDetailGrids();
this.ResumeLayout();

And this is the error message:

An unhandled exception of type ‘System.Reflection.TargetInvocationException’ occurred in mscorlib.dll

Additional information: Exception has been thrown by the target of an invocation.

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.NullReferenceException: Object reference not set to an instance of an object.
at EcoChemie.NovaCV.Controls.Commands.ParameterGrid.DetailGrid_CollapsedChanged(Object sender, EventArgs e) in c:\products\ecochemie\autolab\commandlibrary\parametergrid.cs:line 521
— End of inner exception stack trace —
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess)
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean verifyAccess)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.MulticastDelegate.DynamicInvokeImpl(Object[] args)
at System.Delegate.DynamicInvoke(Object[] args)
at Xceed.Grid.GridElement.RaiseEvent(Object eventKey, EventArgs e)
at Xceed.Grid.GroupBase.OnCollapsedChanged(EventArgs e)
at Xceed.Grid.GroupBase.Expand()
at EcoChemie.NovaCV.Controls.Commands.ParameterGrid.ShowCommand() in c:\products\ecochemie\autolab\commandlibrary\parametergrid.cs:line 385
at EcoChemie.NovaCV.Controls.Commands.ParameterGrid.set_Root(ITreeMap value) in

Cheers,

Kees

Imported from legacy forums. Posted by keesp (had 3652 views)