?
Solved

TreeView Node Tag

Posted on 2006-11-16
3
Medium Priority
?
323 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1000 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month11 days, 17 hours left to enroll

752 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