Click here to Skip to main content
15,908,166 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello!I use a treeview with some nodes,I want that some of these nodes shoule be disable like enable = false before they were checked.
I use codes like below,in the treeview Before_Checked events but I found the node still can be click ,could anyone tell me how to change it and let it work?THX a lot!

VB
Private Sub aTree_BeforeCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewCancelEventArgs) Handles aTree.BeforeCheck
        Dim a As TreeNode
        a = aTree.Nodes(0).Nodes(1)
        a = e.Node
        If e.Node.ForeColor = Color.Gray Then
            e.Cancel = True
        End If
    End Sub
Posted

:sigh: :sigh: still not work like what I wanted,anyone could help me? :((
 
Share this answer
 
The link that I post here is for C#, but you could get a general idea from it[^].
 
Share this answer
 
Comments
sanyexian 11-Jul-10 4:00am    
Abhinav,THX!I've read that page ,what I used in my code is similar like the page said ,but I found the node still could be selected...Still THX~

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900