Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8028751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:13:02+00:00 2026-06-05T00:13:02+00:00

I am working with a treeview that contains nodes from a directory, where the

  • 0

I am working with a treeview that contains nodes from a directory, where the lowest node is a piece of text from a file. I would like to be able to get that node, and get it’s filename, and ive done so in the following line of code, but is there a nicer way of doing this? I want it to be as efficient as possible, and i’m wondering if its better to just create an integer to store the index number, rather than calculating it in the index itself. I know if the integer variable is created i will have to do that calculation anyway…

(tVSNodes is a list of treenodes)

TL:DR – is there a more efficient(faster execution) way of doing this?

string filename = tVSNodes[0].FullPath.Split('\\')[(tVSNodes[0].FullPath.Split('\\').Count()-2)];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T00:13:03+00:00Added an answer on June 5, 2026 at 12:13 am

    It looks like you’re just trying to get the text of the parent node.

    if (tVSNodes[0].Parent == null)
         return;  // handle appropriately
    
    string fileName = tVSNodes[0].Parent.Text;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to create a 'jsTree' treeview that gets it's data from a .Net
I'm working on a project that heavily uses TreeView and TreeNodes. However, I need
I have a project that I'm working on that has a TreeView Control in
I am working on a WPF application which has a treeview that represents an
I'm working with a library (TreeView in Gtk to be specific) that allows you
I'm working with the treeview and I've seen that I can get the selected
I am currently trying to populate a treeview from xml that is returned to
Ok. I've been working a lot on a treeview and I decided that it
I'm working with application, which use TreeView. I want some nodes have checkBoxes, but
I've got a windows form object that contains 3 objects, a treeview, a richtextbox,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.