Posted 12 April 2022, 6:52 pm EST
See attached sample: this call might fail:
this.c1FlexGrid1.Rows[rowParent].Node.AddNode(NodeTypeEnum.LastChild, "Child");
It will fail if you add nodes to an existing grid, and it will fail only if “BeginUpdate” is false.
In my sample, I first create the root nodes, and afterwards I want to insert some child nodes for the first root node using “AddNode(NodeTypeEnum.LastChild, …)”.
Here, the first child row is inserted at row “0” (header row) instead of row 2.
Subsequent calls to “AddNode” will fail with an exception:
System.NullReferenceException
HResult=0x80004003
Message=Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
Source=C1.Win.C1FlexGrid.4.5.2
StackTrace:
at C1.Win.C1FlexGrid.Node.AddNode(NodeTypeEnum position, Object data, Object key, Image img)
at C1.Win.C1FlexGrid.Node.AddNode(NodeTypeEnum position, Object data)
at C1FlexGridNodeAdd.Form1..ctor() in C:\Temp\C1FlexGridNodeAdd\Form1.cs:line 61
But I think the main cause for this issue is, that the first child node is inserted at the wrong location and and thus the next insert will fail.
Now I will try to find a workaround (our real world app is a bit more complex than the sample). If this is not possible, I will switch back to .532.
Best regards
WolfgangC1FlexGridNodeAdd.zip