Click here to Skip to main content
15,911,360 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi all ,
I have to show all the files and the folders of the desktop from the treeview control but how can i give the path of the desktop.if I check for Desktop string to search it starts searching in the project itself and throws the exception as it fails to locate it ..

thnx
Posted

 
Share this answer
 
VB.NET
VB
My.Computer.FileSystem.SpecialDirectories.Desktop
see SpecialDirectories Class[^]


C#
C#
Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
see Environment.GetFolderPath Method[^]
 
Share this answer
 
C#
string pathToTheDesktopOfTheCurrentUser
    = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900