473,490 Members | 2,488 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

select a file in Explorer

Hi,

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
System.Diagnostics.ProcessStartInfo;
prStartInfo.FileName = "explorer";
prStartInfo.UseShellExecute = true;
prStartInfo.WindowStyle = ProcessWindowStyle.Normal;
prStartInfo.Arguments = '"' + folderName + '"';
System.Diagnostics.Process.Start(prStartInfo);

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

Any help is much appreciated.

Nov 16 '05 #1
3 4213
Sergey,

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/de...classtopic.asp

Just my thought,

Cor

Nov 16 '05 #2
Cor,

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
language).

Kind regards,

Sergey
-----Original Message-----
Sergey,

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-
us/cpref/html/frlrfsystemwindowsformsopenfiledialogclasstop
ic.asp
Just my thought,

Cor

.

Nov 16 '05 #3
Sergey,

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.

Download
http://www.gotdotnet.com/Community/W...f-c111fe60ed58

Description
http://msdn.microsoft.com/vbasic/def...werpack_topic8

I think it will not help however you never know?

Cor


Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4638
by: Pasquale | last post by:
Hello, I wondering if there is a way to dynamically update a select list with javascript from a database query without having to reload the page to update the list?
6
29976
by: Dan Bass | last post by:
If you look at explorer, right clicking on a file, first selects the file, then throws up the context menu relating to that selection. With a Windows ListBox control and a simple context menu,...
8
9791
by: Dinesh Jain | last post by:
Hi all, I encountered a serious problem while working with clipboard class in VB.NET. I want to simulate cut-copy-paste operation with my application and Windows Explorer. User can copy files...
2
2942
by: Bruce Russell | last post by:
This may sound stupid but I can't rename the WebForm1.aspx in the solution explorer. The file is located in my local web server at C:\Inetpub\wwwroot\Lab3-VB-Starter\WebForm1.aspx Is there...
3
2726
by: Sergey Poberezovskiy | last post by:
Hi, 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: Dim directoryName As String = New...
4
2162
by: tshad | last post by:
At work we are setting up a new web site and had a problem with running a page when using URL: \\phoenix\cdrive\inetpub\wwwroot\hrworkshop\index.aspx It would start up notepad to edit the...
1
6341
by: diaboliko80 | last post by:
Salve a tutti. Ho un problema con IE7. Ho implementato una pagina .asp che tramite tecnologia AJAX mi crea una serie di select nidificate (il classico esempio delle Regioni-Province --scelgo...
21
29736
by: Leena P | last post by:
i want to basically take some information for the product and let the user enter the the material required to make this product 1.first page test.php which takes product code and displays...
0
1223
by: palomino100 | last post by:
Hello! I set my setup project to run directly from Windows Explorer the files of my application. Now i can only select the files one by one and passing them separately as a parameter in my...
0
7142
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7181
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5445
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4875
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
618
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.