Invalid Cast Exception in NTreeList control


Author
Message
Tomas Vera
Tomas Vera
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
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
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
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
lars knox
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
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

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search