Profile Picture

Invalid Cast Exception in NTreeList control

Posted By Tomas Vera 13 Years Ago
Author
Message
Tomas Vera
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 4, Visits: 1
Hello,
I am using a NTreeList control in detail view.
When I first populate the control, I am able to sort the columns as expected.
But if I add entries to my data source and rebuild the node collection, as soon as I click on any column header, I get an exception:

"An unhandled exception of type 'System.InvalidCastException' occurred in Nevron.Presentation.dll

Additional Information: Unable to cast object of type 'Nevron.UI.Winform.Controls.NTreeListNode' to type 'Nevron.UI.Winform.Controls.NTReeListHeaderItem'
"

Unfortunately, this error is holding up release of a product update (of course).

Any help/ideas are much appreciated!

-tomas

Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
Hi Tomas,

Can you describe how do you add entries in your data source and rebuild the nodes collection?

Do you use NTreeListTableData to bind your data source to the NTreeList?

I am asking this to be able to reproduce the problem you got and find what cause it.





Best Regards,
Nevron Support Team



lars knox
Posted 13 Years Ago
View Quick Profile
Junior Member

Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 22, Visits: 1
Hi,

I work with Tomas. Just wanted to post this solution in case anyone else needs it. If you use ".Nodes.Clear();" subsequent mouse clicking on the control will create the error mentioned above. The work-around was to use ".Nodes.RemoveAt(0);" (between SuspendLayout and ResumeLayout of course) until there are no more nodes in the tree. This will give a similar effect without causing subsequent errors.

Lars




Similar Topics


Reading This Topic