Solved

TreeView Node Tag

Posted on 2006-11-16
3
307 Views
Last Modified: 2011-09-20
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!
0
Comment
Question by:SteSi
  • 2
3 Comments
 
LVL 7

Expert Comment

by:Mohamed Zedan
ID: 17954481
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 :)
0
 
LVL 5

Expert Comment

by:Venkateswarlu Kaipu
ID: 17954768
dim NodeDetails

NodeDetails = ProdView.SelectedItem.tag

Msgbox NodeDetails
0
 
LVL 7

Accepted Solution

by:
Mohamed Zedan earned 250 total points
ID: 17954783
Sorry I typed nodeinfo instead of ProductStruc thought it was the structure name :)


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

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


hope this helps :)
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now