Treeview Selected Nodes

Since there is no click event for the Treeview control in CF 1.1, is there a way to determine if any node is selected?

When I testtreeBuilding.SelectedNode.Indexto see if any index is selected, and nothing is selected, I get the following message:

An unhandled exception of type 'System.NullReferenceException' occurred in prjRoofAssessment.exe

Is there way to test for this being null, or is there another property to test to determine that NO nodes are selected?

[600 byte] By [unit107] at [2007-12-16]
# 1
First, there is no CF 1.1 - only v1.0 (with 3 service packs) and v2.0 (in Beta).

You can test if treeBuilding.SelectedNode exists.
c#
== null
vb
Is Nothing

If it is null/nothing then there is nothing selected (which is why you get the nullreferenceexception when you try to access the Index property of a nonexistent object).

Cheers
Daniel

DanielMoth at 2007-9-9 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...