Solved

Checkbox in treeview

Posted on 2011-09-11
5
520 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 200 total points
ID: 36519530
0
 
LVL 86

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

690 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