treeview - i'm on vb6

User avatar
HansV
Administrator
Posts: 78991
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: treeview - i'm on vb6

Post by HansV »

What do you want to do and why?
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4440
Joined: 26 Apr 2010, 17:36

Re: treeview - i'm on vb6

Post by sal21 »

HansV wrote:
20 Jun 2024, 11:05
I'd stick with what works now. Adding the count is possible but complicated.
ops...SORRY but important.

with other code i retrieve

the numbers of region for zona
the numbers of provinces for regione
the numbers of istat for each provincia

the var of numbe is named NRSTRING

possible to insert in tag with the NRSTRING'

for example:

1-NORD OVEST tag=4 (4 are the regions of 1-NORD OVEST)

1-PIEMONTE tag=8 (8 are the provinces of 1-PIEMONTE)

TO-TORINO tag=312 (312 are the ISTAT-COMUNI of TO-TORINO)

Eccc...

Note:
i get the number of ZONE, REGIONI, PROVINCE, with:

...
Select Case LEVEL

Case 0
'ZONA
VV = Split(VALORE, "-")(0)
'Debug.Print VALORE
NRSTRING = ""
CERCA_NUM VV, LEVEL + 1
Case 1
'REGIONE
VV = Split(VALORE, "-")(0)
'Debug.Print VALORE
NRSTRING = ""
CERCA_NUM VV, LEVEL + 1
Case 2
'PROVINCIA
VV = Split(VALORE, "-")(0)
'Debug.Print VALORE
NRSTRING = ""
CERCA_NUM VV, LEVEL + 1

End Select

'Debug.Print LEVEL

Set CHL = Me.TreeView1.nodes.Add(Relative:=NOD, Relationship:=tvwChild, Text:=VALORE)
'Me.TreeView1.nodes.Add(Relative:=NOD, Relationship:=tvwChild, Text:=VALORE).Tag = NRSTRING

....

User avatar
HansV
Administrator
Posts: 78991
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: treeview - i'm on vb6

Post by HansV »

Set CHL = Me.TreeView1.Nodes.Add(Relative:=NOD, Relationship:=tvwChild, Text:=VALORE)
CHL.Tag = NRSTRING
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4440
Joined: 26 Apr 2010, 17:36

Re: treeview - i'm on vb6

Post by sal21 »

HansV wrote:
01 Jul 2024, 10:38
Set CHL = Me.TreeView1.Nodes.Add(Relative:=NOD, Relationship:=tvwChild, Text:=VALORE)
CHL.Tag = NRSTRING
WOW! TKS

But i dont have a tag for the last level ISTAT-COMUNI, possible with a if to exclude tis level?

User avatar
HansV
Administrator
Posts: 78991
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: treeview - i'm on vb6

Post by HansV »

You could check

Code: Select all

    If LEVEL < 3 Then
        CHL.Tag = NRSTRING
    End If
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4440
Joined: 26 Apr 2010, 17:36

Re: treeview - i'm on vb6

Post by sal21 »

HansV wrote:
01 Jul 2024, 12:33
You could check

Code: Select all

    If LEVEL < 3 Then
        CHL.Tag = NRSTRING
    End If
:clapping:

User avatar
sal21
PlatinumLounger
Posts: 4440
Joined: 26 Apr 2010, 17:36

Re: treeview - i'm on vb6

Post by sal21 »

HansV wrote:
01 Jul 2024, 12:33
You could check

Code: Select all

    If LEVEL < 3 Then
        CHL.Tag = NRSTRING
    End If
based the level number i need to add a icon from iamgelist1.

i just set imagelist in:

...

Set Me.TreeView1.ImageList = ImageList1
.Style = tvwTreelinesPlusMinusText
.nodes.Clear
Set NOD = .nodes.Add(Text:="ITALIA")

...

now based the level i need image1, for level 1,image1, for level 2, image2, for level 3.... eccc

User avatar
HansV
Administrator
Posts: 78991
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: treeview - i'm on vb6

Post by HansV »

Perhaps

CHL.Image = LEVEL
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4440
Joined: 26 Apr 2010, 17:36

Re: treeview - i'm on vb6

Post by sal21 »

HansV wrote:
02 Jul 2024, 16:06
Perhaps

CHL.Image = LEVEL
whre here:

...
Set CHL = Me.TreeView1.nodes.Add(Relative:=NOD, Relationship:=tvwChild, Text:=VALORE)
'qui?
If LEVEL < 3 Then
CHL.Tag = "-(" & NRSTRING & ")"
'qui?
End If

If LEVEL < UBound(ARRLEVELS) Then
AddChildren CHL, LEVEL + 1
'qui?
End If

...

User avatar
HansV
Administrator
Posts: 78991
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: treeview - i'm on vb6

Post by HansV »

Immediately below Set CHL = ...
Best wishes,
Hans

snb
5StarLounger
Posts: 603
Joined: 14 Nov 2012, 16:06

Re: treeview - i'm on vb6

Post by snb »

My suggestion
You do not have the required permissions to view the files attached to this post.