467,120 Members | 1,227 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,120 developers. It's quick & easy.

select a file in Explorer


As part of my Windows application, I need to open a folder
containing a file (fileName is specified in txtFile).
I have no problem opening the folder:
FileInfo info = new FileInfo(txtFile.Text);
string folderName = info.DirectoryName;
System.Diagnostics.ProcessStartInfo prStartInfo = new
prStartInfo.FileName = "explorer";
prStartInfo.UseShellExecute = true;
prStartInfo.WindowStyle = ProcessWindowStyle.Normal;
prStartInfo.Arguments = '"' + folderName + '"';

But how do I select the file within the opened directory?

Any help is much appreciated.

Nov 16 '05 #1
  • viewed: 3884
3 Replies

Any reason that you don't use the stand OpemFileDialog for that?

Users are seldom happy with extraordinair behaviour of programs.


Just my thought,


Nov 16 '05 #2

I know how to use OpeFileDialog, and that was not the
question. If you take a look at the code supplied, it
opens a new explorer window in a separate process. The
functionality I am trying to achieve is something similar
to what happens when you click on FindTarget button in
File Properties explorer dialog box, when a folder
containing the file is opened and the file is selected.
It has nothing to do with opening a standard dialog.

P.S. the reason that I created a separate post in VB is
that the code there is in VB (and not C#) which makes it
easier for VB community to read (at least it made for me
when I only did VB).

Hope you can still help me with my problem (in either

Kind regards,

-----Original Message-----

Any reason that you don't use the stand OpemFileDialog for that?
Users are seldom happy with extraordinair behaviour of programs.
http://msdn.microsoft.com/library/default.asp? url=/library/en-
Just my thought,



Nov 16 '05 #3

My question was as well stated to get more information in this thread.

I have no answer and I go out so have no time to eveluate it for you
directly, however maybe others know.

However find target is of course directly linked to a file that is in that
box. In my opinion not to explorer. Why do you than not build yourself an
own box.

I have not used them yet, however did you see these controls there are some
special file controls in it.



I think it will not help however you never know?


Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Dan Bass | last post: by
2 posts views Thread by Bruce Russell | last post: by
3 posts views Thread by Sergey Poberezovskiy | last post: by
4 posts views Thread by tshad | last post: by
1 post views Thread by diaboliko80@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.