TreeView.Control running code inside the IDE references to the TreeView Control as it should do.
But when compiling the same code and running it from the executable. TreeView.Control is NULL (for an empty TreeView), or references to the last added node.
To reproduce the bug try to change parent to a TreeView using FormLib.
This is a bug in the TreeView library (it will also appear in other controls libraries).
The use of the reserved keyword Control confuses the parser.
I will soon create a new library: ControlLib that will include all the controls libraries and will fix this problem too.
Thank you for finding and reporting it.