?
Solved

Checkbox in treeview

Posted on 2011-09-11
5
Medium Priority
?
522 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 15

Accepted Solution

by:
x77 earned 800 total points
ID: 36519530
0
 
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 400 total points
ID: 36519535
0
 
LVL 70

Assisted Solution

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

Assisted Solution

by:x77
x77 earned 800 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 400 total points
ID: 36526335
See if this advanced treeview can do the trick

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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 synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses

770 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