We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Exception thrown when adding a node in TreeViewAdv

Thread ID:

Created:

Updated:

Platform:

Replies:

62846 Jun 22,2007 10:20 PM UTC Jun 25,2007 04:30 PM UTC Windows Forms 4
loading
Tags: Tools
Mark Atkinson
Asked On June 22, 2007 10:20 PM UTC

I have some (C#) code that looks something like this:

myderivedTreeViewAdv.Nodes.Clear()
DerivedTreeNodeAdv n = new DerivedTreeNodeAdv()
myderivedTreeViewAdv.Nodes.Add (n);

When I attempt to add the node I get an "Object not set to instance..." exception (stack trace below). Any ideas?

Mark

Stack Trace:
at
Syncfusion.Windows.Forms.Tools.TreeViewAdv.get_SelectedNode()
at Syncfusion.Windows.Forms.Tools.TreeNodeAdv.UpdateSelectedNodeIndexCache()
at Syncfusion.Windows.Forms.Tools.TreeNodeAdv.Nodes_CollectionChanged(Object sender, CollectionChangeEventArgs e)
at Syncfusion.Collections.ArrayListExt.OnCollectionChanged(CollectionChangeEventArgs args)
at Syncfusion.Windows.Forms.Tools.TreeNodeAdvCollection.OnCollectionChanged(CollectionChangeEventArgs args)
at Syncfusion.Collections.ArrayListExt.AddHandlers(Object item)
at Syncfusion.Collections.ArrayListExt.Add(Object value)
at Syncfusion.Windows.Forms.Tools.TreeNodeAdvCollection.Add(TreeNodeAdv node)

Mark Atkinson
Replied On June 22, 2007 11:30 PM UTC

More on this:
I've tried a couple of things but I keep getting some odd exceptions ("Cannot access disposed object..." was another one) when trying to manipulate my TreeViewAdv object - typically when doing things like adding nodes or sorting.

The one thing I did notice is: I only get the exceptions when I close down the form that contains my TreeView and then reopen the form. After I've opened it the treeview's parent form a second time is when I start getting exceptions.

>I have some (C#) code that looks something like this:

myderivedTreeViewAdv.Nodes.Clear()
DerivedTreeNodeAdv n = new DerivedTreeNodeAdv()
myderivedTreeViewAdv.Nodes.Add (n);

When I attempt to add the node I get an "Object not set to instance..." exception (stack trace below). Any ideas?

Mark

Stack Trace:
at
Syncfusion.Windows.Forms.Tools.TreeViewAdv.get_SelectedNode()
at Syncfusion.Windows.Forms.Tools.TreeNodeAdv.UpdateSelectedNodeIndexCache()
at Syncfusion.Windows.Forms.Tools.TreeNodeAdv.Nodes_CollectionChanged(Object sender, CollectionChangeEventArgs e)
at Syncfusion.Collections.ArrayListExt.OnCollectionChanged(CollectionChangeEventArgs args)
at Syncfusion.Windows.Forms.Tools.TreeNodeAdvCollection.OnCollectionChanged(CollectionChangeEventArgs args)
at Syncfusion.Collections.ArrayListExt.AddHandlers(Object item)
at Syncfusion.Collections.ArrayListExt.Add(Object value)
at Syncfusion.Windows.Forms.Tools.TreeNodeAdvCollection.Add(TreeNodeAdv node)

JayaLakshmi [Syncfusion]
Replied On June 25, 2007 05:26 AM UTC

Hi Mark,

Thank you for using Syncfusion products.

I am afraid that I could not able to reproduce this issue at my end.

Could you please send me the Customized TreeViewAdv class file and details to reproduce the issue. This will help us to analyze the issue further.

Please have a look at the below sample and let me know if I missed anything.

http://websamples.syncfusion.com/samples/Tools.Windows/F62846/main.htm

Regards,
Jaya

Mark Atkinson
Replied On June 25, 2007 03:46 PM UTC

Hi Jaya,
I'll see if I can create a small app that repro's the problem but I suspect it's somewhere in my code.
The treeView's SelectedNode property always throws a 'null reference' exception when the treeView is disposed and then instantiated a second time.

>Hi Mark,

Thank you for using Syncfusion products.

I am afraid that I could not able to reproduce this issue at my end.

Could you please send me the Customized TreeViewAdv class file and details to reproduce the issue. This will help us to analyze the issue further.

Please have a look at the below sample and let me know if I missed anything.

http://websamples.syncfusion.com/samples/Tools.Windows/F62846/main.htm

Regards,
Jaya

Mark Atkinson
Replied On June 25, 2007 04:30 PM UTC

I figured out my problem - which was definitely my problem and nothing to do with the TreeViewAdv control.
My issue is that I wasn't dealing with some event handlers properly when disposing the control.

Thanks for the prompt support all the same,
Mark

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;