Link to home
Start Free TrialLog in
Avatar of SteSi
SteSiFlag for United Kingdom of Great Britain and Northern Ireland

asked on

TreeView Node Tag

Hi Experts,

I have a treeview in my program and wanted to add more details to a node so i created a structure which i than attached to each node.  The problem i am having is that i am not sure how to refer back to the values stored on the tag.  I assumed it would just be something like: node.tag.name but this does not work.

Here is my code:

    Private Structure ProductStruc
        Friend Name As String
        Friend Type As String
        Friend Details As String
        Friend Notes As String
        Friend Qty As Integer
        Friend IsAddition As Boolean
    End Structure

            Dim NodeInfo As ProductStruc
            NodeInfo.Details = Trim(DetailsTXT.Text)
            NodeInfo.IsAddition = IsAddition
            NodeInfo.Name = Trim(ProductCMB.Text)
            NodeInfo.Notes = Trim(ProdNotesTXT.Text)
            NodeInfo.Qty = QuantityNUM.Value
            NodeInfo.Type = Trim(ProdTypeCMB.Text)

            CurComputerNode = ProdView.Nodes.Add(Trim(DetailsTXT.Text))
            CurComputerNode.Tag = NodeInfo

Cheers for any help!
Avatar of Mohamed Zedan
Mohamed Zedan
Flag of Canada image

All you have to do to get what you want is ctype(CurComputerNode.Tag ,NodeInfo).Name
or

dim ni as NodeInfo = ProdView.SelectedNode.tag
'Then use ni as you like .... it is all a matter of casting tag to the right type :)


hope this helps :)
dim NodeDetails

NodeDetails = ProdView.SelectedItem.tag

Msgbox NodeDetails
ASKER CERTIFIED SOLUTION
Avatar of Mohamed Zedan
Mohamed Zedan
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial