Solved

TreeView Node Tag

Posted on 2006-11-16
3
311 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

911 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

19 Experts available now in Live!

Get 1:1 Help Now