• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 132
  • Last Modified:

Mutli Select

How can i have a tree view support multi select and then have a loop that runs through each selected item...
0
hess
Asked:
hess
  • 6
  • 4
  • 2
1 Solution
 
amebaCommented:
' add treeview, set property Checkboxes=True
Option Explicit

Private Sub Form_Click()
    Dim x As Node, msg As String
    For Each x In Me.TreeView1.Nodes
        If x.Checked Then msg = msg & x.Text & vbCrLf
    Next
    MsgBox msg, , "Selected nodes"
End Sub

Private Sub Form_Load()
    Dim i As Integer
    For i = 1 To 15
        Me.TreeView1.Nodes.Add , , , "node " & i
    Next
End Sub
0
 
hessAuthor Commented:
i can see how taht would work ajnd i'll concider it, but i really would like pure multiselect.
0
 
MTroutwineCommented:
I do not believe the TreeView control supports the MultiSelect property.  I might suggest looking at ameba's code and possible creating your own 'custom' TreeView control that would support MultiSelect.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
hessAuthor Commented:
sounds difficlut...
0
 
MTroutwineCommented:
If you are interested in custom controls here is a good site: http://www.vbaccelerator.com/.  Do a search on TreeView. You will get a cool TreeView control with all of the code to boot!  I have modified this control and added some functionality that I needed, you could do the same thing.  If you do remember to rename the control!!!
0
 
hessAuthor Commented:
ok... thankyou... i actually checked there... been there before.. i theirs doesn't appear to suport multi select. anyways. thankyou. i'm going to go with the check boxes for now.
0
 
hessAuthor Commented:
i guess i'll leave this question up to see if i find a real way to multi select.
0
 
amebaCommented:
If you don't need collapsing/expanding of nodes, i.e. if all nodes are always open, you can have UI you want - it's called indented listview.
0
 
hessAuthor Commented:
sorry... they need to colapse
0
 
amebaCommented:
sorry, this is not supported by control.
0
 
hessAuthor Commented:
I ended up just playing with the back color property of the nodes but i started with check boxes and they worked for a time... now i just faked multi select... thankyou
0
 
amebaCommented:
ยค Thanks
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 6
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now