Solved

Checkbox in treeview

Posted on 2011-09-11
5
509 Views
Last Modified: 2013-11-26
Hi, I would like to display checkbox in my treeview only on lowest level...For e.g. Let say that my hierarchy has 5 levels... I would like to display checkbox only on 5th level...
Is it possibble, and if yes I would appreciate a lot your help in order to make it works for me...

Note: the hierarchy depth can be different from hierarchy to hierarchy (it can be 5, 6 7 etc level hierarchy)
0
Comment
Question by:alsam
5 Comments
 
LVL 15

Accepted Solution

by:
x77 earned 200 total points
ID: 36519530
0
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 100 total points
ID: 36519535
0
 
LVL 69

Assisted Solution

by:Éric Moreau
Éric Moreau earned 100 total points
ID: 36519628
0
 
LVL 15

Assisted Solution

by:x77
x77 earned 200 total points
ID: 36519661
I do´n like use API.

I control when user can check each Node CheckBox on TreeView.BeforeCheck

Private Sub TV_BeforeCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewCancelEventArgs) Handles TV.BeforeCheck
       Select Case e.Action
          Case TreeViewAction.ByKeyboard, TreeViewAction.ByMouse
          Case Else : Return
       End Select

       Dim f = TryCast(e.Node.Tag, Fcs2)
       If f Is Nothing Then Beep() : e.Cancel = True : Return
       If f.IsIndicador Then
           If MessageBox.Show("¿ Desea eliminar el indicador ?", "Eliminar Indicador", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.No Then
              e.Cancel = True : Return
           End If
       Else
           Dim nd = e.Node.Parent
           Do Until nd Is Nothing
              If nd.Checked Then Beep() : e.Cancel = True : Return
              nd = nd.Parent
           Loop
           If TieneIndicador(f) Then e.Cancel = True : Beep() : Return
       End If

       Dirty = True
       mSave.Visible = True
    End Sub

Open in new window

0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 100 total points
ID: 36526335
See if this advanced treeview can do the trick

http://www.codeproject.com/KB/tree/treeviewadv.aspx
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now