special treenode text?

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
 
C

Champika Nirosh

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top