Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TreeView Exception - Is This A Bug?

Status
Not open for further replies.

BDRichardson

Programmer
Jul 23, 2003
46
GB
Hi

I have been using the TreeView, which seemed to work just fine until I began using the BeforeSelect event. Everything seems to function properly, but every once in a while it throws an unhandled exception as follows:

An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll.
Additional information: Object reference not set to an instance of an object.

I am using C# within VisualStudio 2003, and have found discussion about problems with Tags within version 2002, but can't find any infomation which relates to problems with TreeViewCancelEventArgs.

Has anyone else experienced similar problems?

Thanks in advance...
 
It would be easier if you included the code. That error can occur if you try to access the SelectedNode property which does not yet contain the node to be selected but rather the previousle selected node, which may be Nothing.

Compare Code
 
Thanks for your assistance. Unfortunately, there is too much code to practically provide it really.

I am quite confident that there is bug within the control since I can reproduce the problem over and over. Although I repeatedly make the exact same mouse clicks every time, sometimes the unhandled exception is thrown, and then other times it isnt.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top