Solved

Checkbox in treeview

Posted on 2011-09-11
5
508 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
Comment Utility
0
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 100 total points
Comment Utility
0
 
LVL 69

Assisted Solution

by:Éric Moreau
Éric Moreau earned 100 total points
Comment Utility
0
 
LVL 15

Assisted Solution

by:x77
x77 earned 200 total points
Comment Utility
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
Comment Utility
See if this advanced treeview can do the trick

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

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
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 tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

744 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

16 Experts available now in Live!

Get 1:1 Help Now