[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 240
  • Last Modified:

Fields to store SelctedNode C#

Hi,
Currently I have SelctedNode.Name and SelctedNode.Tag to store 2 fields I want to use later on.
But now i have a 3rd text field I want to store it.
Is there another function in SelctedNode. I can use or I can use the SelctedNode.Name again in another way?
0
csharp_learner
Asked:
csharp_learner
  • 2
  • 2
1 Solution
 
Gautham JanardhanCommented:
u can use the .Tag property to store it as an array like

node.Tag = new object[]{valuetostore1,valuetostore2,valuetostore3};

Open in new window

0
 
csharp_learnerAuthor Commented:
Thanks for the prompt reply.
So how can i access to the individual tag?
Cos when i tried to access to the individual array it prompts an error.
"treeview.SelectedNode.Tag[0].ToString();"
0
 
Gautham JanardhanCommented:

((object[])treeview.SelectedNode.Tag)[0].ToString();

Open in new window

0
 
csharp_learnerAuthor Commented:
Thanks, exactly what I was looking for.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now