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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

NullReferenceExceptions in TreeViewAdv

Thread ID:





30900 Jun 27,2005 07:04 AM UTC Jun 30,2005 01:21 AM UTC WinForms 4
Tags: Tools
Sue Harris
Asked On June 27, 2005 07:04 AM UTC

I''ve got a control which overrides the TreeViewAdv and recreates itself when certain events in my object model occur (representing changes in the tree). However, I''m getting a lot of NullReferenceExceptions in TreeViewAdv during those events - for example calling SelectedNode excepts because SelectedNodes is null (and the get doesn''t check it before looking at the count). Also in BeginUpdate and Nodes.Add Is there some method or something that puts the tree in a safe state or something that I''m missing? Sue

Administrator [Syncfusion]
Replied On June 27, 2005 06:34 PM UTC

Hi Sue, You might want to try calling BeginInit as follows, with a call to EndInit when you''re done. ((System.ComponentModel.ISupportInitialize)(this.treeViewAdv1)).BeginInit(); While I''m not familiar with the exact functionality of that call, I would think it ought to put the Tree in a safe state. If that doesn''t work, please let me know and I''ll look into this further. Regards, Gregory Austin Syncfusion Inc.

Sue Harris
Replied On June 27, 2005 10:27 PM UTC

Hi Gregory, Unfortunately the Begin/EndInit calls didn''t make any difference. I would appreciate it if you could look into it further. Thanks, Sue

Administrator [Syncfusion]
Replied On June 28, 2005 08:09 PM UTC

Hi Sue, I talked with the author of TreeViewAdv and he suggested SuspendLayout and/or LockWindowUpdate as possible solutions, depending on what you''re trying to do. Do you have a sample that you could send me that demonstrates exactly what you''re trying to do so that I can step through it and tell exactly where it''s crashing? Regards, Gregory Austin Syncfusion Inc.

Sue Harris
Replied On June 30, 2005 01:21 AM UTC

I figured out that the event was occuring after the control had been disposed -hence why there was so many NullReferences. Thanks


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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