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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

add information to treeview node

Status
Not open for further replies.

macl

Programmer
Sep 15, 2004
65
DE
Hi all i have another problem
i have a treeview, the nodes in it already got a tag added to it
now i need to put additional information to each node
since the information in the tag is beein used very often in the programme i would rather not change the tag as it would be difficult to make the right changes everywhere in the code too
so im looking for a way that allows me to put that information to the node without putting it in the tag or name or key of the node because those already got information further used in the programme
does somebody know if there is something else where i can put it?
thanks so much :)
 
Hi!

An idea:
You could construct an array to hold your info. Something like this:
Code:
Public Type ExtraInfo
    ExtraInfo1 As Integer
    ExtraInfo2 As String
    ExtraInfo3 As Date
End Type

Public MyArray() As ExtraInfo

Then you can fill the array with the nodes (using as a link the Node.Key). You can add as many "ExtraInfo" as you want and it daosn't affect the rest of your code, I think... Only a little bit of searching routinne into that array.

Does this work for you?

Hope I've been helpful,
Bogdan Muresan.
 
thank you for your suggestion :)
i tried it by crating a extra child to those nodes i need the special info and then wanted to put those childs on invisible so my code in the loop to get all the data of the recordset into the node looks like this:


Set nodeX = tvwToFill.Nodes.Add(strRootKey, tvwChild, strNodeKey, strNodeName)
nodeX.Tag = "Level " & CStr(lngLevel)
If lngLevel = 8 Then
If Not IsNull(recInput.Fields(1)) Then
Set nodeY = tvwToFill.Nodes.Add(strNodeKey, tvwChild, strNodeKey & "\" & recInput.Fields(1), recInput.Fields(1))
nodeY.Tag = "Level 9"
nodeY.Visible = False

End If
End If
nodeX.Sorted = True

End If
It works fine as long as i dont put in the line nodeY.Visible = False
but then of course the node with the extra information is visible
so if i try set it to invisible with nodeY.Visible = False
then only the first data of eg 5 in the recordset is put into a node and the child with the extra information to it is still visible
i dont know is there a other possibility to set it invisible?
 
I can not test your code to see what is wrong; I don't have VB installed on this machine.
A guess: maybe because "node Y" is the only one on his level he can't be hidden?
I wonder if your approuch is good... Will you not have problems with the "+" sign of the parrent node of your hiden one?

Hope I've been helpful,
Bogdan Muresan.
 
it seems beeing the only child is not to be the reason why i cant set it invisible i tried it with more childs and it didnt work there either
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top