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?
ADAdministrator Syncfusion Team June 27, 2005 01:34 PM
You might want to try calling BeginInit as follows, with a call to EndInit when you''re done.
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.
SHSue HarrisJune 27, 2005 05:27 PM
Unfortunately the Begin/EndInit calls didn''t make any difference. I would appreciate it if you could look into it further.
ADAdministrator Syncfusion Team June 28, 2005 03:09 PM
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?
SHSue HarrisJune 29, 2005 08:21 PM
I figured out that the event was occuring after the control had been disposed -hence why there was so many NullReferences.