special treenode text?

  • Thread starter Thread starter Jianren Lu
  • Start date Start date
J

Jianren Lu

Dear all,
I put the PC's desktop to my TreeView list. The code is as
follows. But the text of treenode is too long, I want to just put a
shortname to the treenode, how can I do? if I just put
specialTN.Text="Desktop", it can display such shortname, but DeskTop
can't be open in this case.


string deskTop=Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
TreeNode specialTN = new TreeNode(deskTop, 0, 1);
treeView1.Nodes.Add(specialTN);
specialTN.Text="Desktop";

Jianren
 
Hi,

Yes to open the Desktop you need to have the fully qualified path.. So you
better use the TreeNode Tag property to store the real path

Nirosh.
 
Back
Top