954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

open folder

Hi,

how can i open and show a folder in windows using C#. like after complting some task i want the app to open the particular folder and present it to the user.

like we open any folder by double clicking on it. I want to do it the same thru code

thx

gallian99
Junior Poster in Training
77 posts since Jan 2009
Reputation Points: 10
Solved Threads: 0
 

You can use the OpenFileDialog or FolderBrowserDialog from the toolbox.

ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
 
You can use the OpenFileDialog or FolderBrowserDialog from the toolbox.


i'm already using that in my program. But I couldn't figure out how I can open and show the folder to the user, not in my program and not for file selecting or browsing folders;

Ok in short this is what the program does

1. Ask the user to browse folder
2. Read all the files within the folder
3. check files for integrity
4. and then finishes

Now I want to do

5. Show the folder to the user in which the processing was done. i.e. open that folder in windows. thats it

I hope i'm clear now

thx

gallian99
Junior Poster in Training
77 posts since Jan 2009
Reputation Points: 10
Solved Threads: 0
 

You make it perfectly clear!
OpenFileDialog has a property called InitialDirectory, feed it the folder the user was browsing, is this what you want?
Or do you want to take your app to the background, to manipulate XP? Vista? to open a FileDialog for the folder which your app was manipulating?

ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
 
You make it perfectly clear! OpenFileDialog has a property called InitialDirectory, feed it the folder the user was browsing, is this what you want? Or do you want to take your app to the background, to manipulate XP? Vista? to open a FileDialog for the folder which your app was manipulating?


Yes, I want the later case

to take my app to the background, to manipulate XP? Vista? to open a FileDialog for the folder which your app was manipulating?

so the app can sshow the user which files in the folder were processed.

gallian99
Junior Poster in Training
77 posts since Jan 2009
Reputation Points: 10
Solved Threads: 0
 

No, Danny they need to do that
System.Diagnostics.Process.Open("DirectoryPath");
C# Sample

System.Diagnostics.Process.Open("C:\\Windows");
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
 

Thanks for pointing this out Ramy!
Did not know this.:-/

ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You