Solved

Checkbox in treeview

Posted on 2011-09-11
5
514 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 70

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

776 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