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. Image for the cookie policy date
close icon

NullReferenceExceptions in TreeViewAdv

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

4 Replies

AD Administrator Syncfusion Team 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.


SH Sue Harris 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


AD Administrator Syncfusion Team 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.


SH Sue Harris 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

Loader.
Live Chat Icon For mobile
Up arrow icon