Click here to Skip to main content
15,899,124 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
I wanted to load the browse dialog with previous selection.
on opening the browse dialog it should come with previous selection folder/file..

can any one help me regarding this.
Posted

fist of all you can use CFileDialog to do so.:)
for more information on same you may go throught following link of msdn.
CFileDialog[^]
Or better refer your msdn.

Now question remain about you need previous directory!!!.
To do so,
CFileDialog open by default CurrentDirectory when it is open.
Means before modal of your CFileDialog if you check
GetCurrentDirectory()
Function you will get one path same path refered by CFileDialog to open.

after that, in any case if you change the current directory you get updated path in CFileDialog.
CurrentDirectory can be change two way.
1)if you call SetCurrentDirectory.
2)And CFileDialog also changes selected path as current directory.

So your solution is that,
1)Never change currentDirectory

Or

2)Better Make on String Variable to store directory path and setDirectory before calling CFileDialog.
;)
Hope it will work for you..

And Yes if you talking about Folder Tree browse dialog then there ,
Not possiblility about setting path.
Because it shows by default Desktop path as currentDirectory.
 
Share this answer
 
v2
Comments
P Uday kishore 17-Apr-13 2:28am    
we created a custom browse dialog for that one side tree control and other list control we used.
now am saving the path also of the current selection.i need to load that into that tree control now...
Coder Block 17-Apr-13 2:32am    
Yup then there bit logic.
See you have path that currently selecty ok,
Now you need to set tree node programmically with selected folder that is,
After loading your FolderStruture on tree control(Customize one) just set the node of tree with previously selected folder.
P Uday kishore 17-Apr-13 3:13am    
ya am looking on that.not able to set the path to that shell tree control...
Coder Block 17-Apr-13 3:25am    
so best article for you is this 1,
perfect match of folder selection..

http://www.codeproject.com/search.aspx?q=Folder+browser+dialog&usfc=false&doctypeid=1
P Uday kishore 17-Apr-13 5:30am    
hey can we compare the node items so we can get that????
Try this:
C#
folderBrowser.SelectedPath = "yourpath";
 
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