I've got this code:
If Treeview1.SelectedNode.Checked = True Then
For Each nd As TreeNode In Treeview1.Nodes
If nd.Text <> Treeview1.SelectedNode.Text Then
nd.Checked = False
End If
Next
End If
I've tried this in the NodeMouseClick event
but, when I click on the checkbox in the treeview, the node is not selected,
so I get the old
'object reference not set to an instance of an object'
error
I need to, when I check the node (I guess), have the node selected at the
same time - - am I right?
If so, how do I do that?
"Robbe Morris - [MVP] C#" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> You have to write your own code for that. If the current node
> has just been checked, iterate through the tree and uncheck every
> other node. If the current node is unchecked, do nothing.
>
> --
> Robbe Morris [Microsoft MVP - Visual C#]
> .NET Setup Deployment - MSI, Cassini, SQL Server, NTFS
> http://www.eggheadcafe.com/tutorials...oyment--m.aspx
>
>
>
> "Elmo Watson" <(E-Mail Removed)> wrote in message
> news:%23$(E-Mail Removed)...
>>
>> Is there any way to make checking a checkbox in a Treeview mutually
>> exclusive?
>>
>> That is, to make it so that only one item may be selected....
>>
>>
>