• 0

C# and making a TreeView out of arrays


Question

So I have encountered a probleem while trying to populate a TreeView control with nodes. I hope that there are a some kind people who t?ke the time and help me figuure out a correct solution.

So lets say I have 3 arrays:

 

["Example", "2", "1"]

{"Example", "2", "2"]

["Example", "3", "0"]

 

I know that my arrays have always exactly 3 elements in them, so the treeview will never have more than 3 childnodes

 

But all I am able to get is

 

Example

 2

  1

Example

 2

  2

Example

 3

  0

 

But the goal would be:

 

Example

 2

  1

  2

 3

  0

 

So where would I start chasing down the answer to my probleem?
Big thanks in advance :)

 

 

Recommended Posts

  • 0
  On 28/12/2013 at 04:13, Andre S. said:

I'm not sure if we're talking past each other... this:

new List<string[]> {
     { "a", "b", "c" },
     { "b", "c", "d" }
}

is not and never was legal C#.

 

Yeah, I understood what you meant there. I was trying to make a bad joke and say that using using the valid syntax (with new[]) was good in that case regardless of opinion (because you have to use it). Sorry, I wasn't clear! :)

This topic is now closed to further replies.
  • Posts

    • Not to sound ungrateful for your continued presence on Neowin (which I prefer) 😛  But would you consider a subscription to just have all the third party ads turned off by us? It's $28 ($2.33 per month) for the ad-free subscription, but it is also there for assistance and support with all the running costs. Like everything, it is becoming increasingly harder to do this, we even try to offset it with Amazon affiliate commissions (if we could finance totally through that instead of ads, I would) 😛 
    • Honestly, I don't remember accepting or refusing cookies following a prompt, because I've accepted or refused cookies on several other sites. On the other hand, I remember seeing  ads, before the start of the available articles (on the home page), and on the right. If the trackers I've mentioned are part of the cookies I have to accept (as well as those below), trackers that are detected by my antivirus as adware during the weekly scan, they'll remain where they are. The vast majority of cookies blocked by the Host file were added by Unchecky. I'd say so, but are Doubleclick, Scorecardresearch, Opencandy, file2desktop, etc. among those that should be accepted? If not, then I'd say no.  
    • Are you suggesting Vivaldi isn't Chromium-based or that it isn't fast? In any case, Skyfrog seems more focused on customizability.
    • "They fear that this collaboration could significantly bolster China's AI capabilities" how long is this supposed to stop china?, 5 years and then become an AI giant?, china is gonna be as big as the US in AI in no time
    • yeah... I'm gonna say this aint tech news either, don't turn this site into the verge......
  • Recent Achievements

    • Week One Done
      jbatch earned a badge
      Week One Done
    • First Post
      Yianis earned a badge
      First Post
    • Rookie
      GTRoberts went up a rank
      Rookie
    • First Post
      James courage Tabla earned a badge
      First Post
    • Reacting Well
      James courage Tabla earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      403
    2. 2
      +FloatingFatMan
      179
    3. 3
      snowy owl
      172
    4. 4
      ATLien_0
      170
    5. 5
      Xenon
      135
  • Tell a friend

    Love Neowin? Tell a friend!