Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Treeview Next Question 1

Status
Not open for further replies.

edderic

Programmer
May 8, 1999
628
Hi

I have this in the Treeview :

- Akte 2
- Que 1:
- Playback 1:
-Move1
-Move3
-Move4
- Playback 2:
-Move5
-Move6
-Move7
- Akte 3
- Que 2:
- Playback 2 :
-Move4
-Move1
-Move3

No I wil 4 Buttons with :

1 = Expand Aktes
2 = Expand Ques
3 = Expand Playbacks
4 = Expand All

Thanks

Eric
Eric De Decker
vbg.be@vbgroup.nl

License And Copy Protection AxtiveX.

Download Demo version on my Site:
 
Hi!

Following codes expand necessary tree view nodes if nodes keys include keyWords: Akte, Que, Playback

private sub trvNodesExpande()
dim i as long
dim strKey as string
dim nodX as node

select case cmdButton
case 1
strKey = "Akte"
case 2
strKey = "Que"
case 3
strKey = "Playback"
case 4
strKey = ""
end select

for i=1 to trvTreeview.nodes.count
set nodx=trvTreeview.nodes(i)
if nodx.children>0 then
if instr(1,nodx.key,strKey,vbTextCompare)<>0 then
nodx.expanded=true
endif
endif
next i
end sub

Aivars
 
Thanks but the problem is that the buttons are Toolbar buttons and the Ques are : Que 1 ,Que 2 ,Que 3 etc

I have the next module with :

Public Sub ExpandNodes(Tree As TreeView, Capt As String)
Dim i As Integer
Capt = &quot;&quot;
With Tree.Nodes
For i = 1 To Tree.Nodes.Count
If .Item(i).Text = Capt Then
.Item(i).Expanded = True
End If
Next i
End With
End Sub
'Toolbar button
Case &quot;Aktes&quot;
ExpandNodes tvwDB, &quot;Aktes&quot;

This works only for the Aktes and not for the Ques,Playbacks,Moves

Thanks
Eric De Decker
vbg.be@vbgroup.nl

License And Copy Protection AxtiveX.

Download Demo version on my Site:
 
Hi,

You might want to remove the line:

Capt = &quot;&quot;

Should work then.

Madlarry
 
Hi,

Actually it still won't work. Replace the line:

.Item(i).Expanded = True

with:

.Item(i).Selected = True

Then it should work.

Madlarry
 
I remove Cap =&quot;&quot; and .Item(i).Selected = True

No working !!! Eric De Decker
vbg.be@vbgroup.nl

License And Copy Protection AxtiveX.

Download Demo version on my Site:
 
Hi Eric,

I'm not sure if I understood exactly what you're looking for, but wouldn't something like this work?

Public Sub ExpandNodes(Tree As TreeView, Capt As String)
Dim i As Integer

With Tree.Nodes
For i = 1 To Tree.Nodes.Count
If Instr(1, .Item(i).Text, Capt, vbBinaryCompare) > 0 then
.Item(i).Expanded = True
.Item(i).Parent.Expanded = True 'You'll need to make a loop to ensure all the parents are expanded...
End If
Next i
End With
End Sub

'Toolbar button

Case &quot;Aktes&quot;
ExpandNodes tvwDB, &quot;Aktes&quot;

Case &quot;Que&quot;
ExpandNodes tvwDB, &quot;Que&quot;

etc

Let me know if this isn't exactly what you were after
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top