Re: Treeview Node Type



I've done this sort of thing a variety of ways. The most flexibility
and less troublesome in regards to managing parent object references
if you do a bunch of drag and drop of tree nodes is do to
the following.

Create a simple class that has some sort of Guid or Unique ID, an
object name or possibly an enum, and a text description.

Store this object in the TreeNode.Tag property. Whenever
you get the selected node, grab the .Tag

CustomClass rob = (CustomClass)tree.SelectedNode.Tag;

--
Robbe Morris - 2004-2006 Microsoft MVP C#
Earn money answering .NET questions
http://www.eggheadcafe.com/forums/merit.asp





"Chris" <nospam@xxxxxxxxxxxxxx> wrote in message
news:e2vNgJpdGHA.3352@xxxxxxxxxxxxxxxxxxxxxxx
Is there any way when progratically adding nodes to assign them some kind
of type group nodes that want to different things to. I am creating an
Explorer type interface and need to differentiate between folder and file
nodes in my code. Regards, Chris.



.



Relevant Pages

  • Re: chester aftersales service
    ... I`ve had a nice email from Chesters and they are going to sort ... Best regards ... Stuff like the Adept lathes or some like the AA lathes from the US. ...
    (uk.rec.models.engineering)
  • Re: New Elliott Randall CD (EP) ...and GUITAR DAY at my place
    ... Thanks you for the compliments! ... next couple of months - cover art is ready, ... Lotsa research as this is a Brave New World as regards this crazy ... what I sort of expected, very tasteful, funky,still got a sort of ...
    (uk.music.guitar)
  • Re: One Brave Jewish Woman
    ... Best regards, ... does not have any sort of middle eastern accent as ... Action Committees and ANSWER. ...
    (soc.culture.jewish.moderated)
  • Re: Abbreviation List Tables Design, aka OTLT
    ... We still use this sort of index.!! ... various b-tree type indexes up.... ... Regards ... > Can vaguely recall something similar.... ...
    (comp.databases.pick)
  • Re: Filling in Blank Cells
    ... easier to then sort on this to bring any duplicates together. ... Regards. ... >>> Peo Sjoblom ...
    (microsoft.public.excel.newusers)