?
Solved

Explorer Issue

Posted on 2006-10-25
3
Medium Priority
?
169 Views
Last Modified: 2010-04-16
Hi,
I have a forms program that the user clicks on a button and its bring up windows explorer to the following default location here is the current code

            Process x = new Process();
            x.StartInfo.FileName = "C:\\windows\\explorer.exe";
            x.StartInfo.Arguments = "C:\\Program Files\\Application X\\Images";
            try
            {
                x.Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error :" + ex.ToString());
            }

How can the code be modified to still open up the to images directory if the program was isntalled to say

"C:\\Program Files\\Application W\\Images";

Thanks

Peter
0
Comment
Question by:schenkp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 21

Expert Comment

by:K V
ID: 17809468
do you mean that Application W does not exists and it still opens Application X ?
well in that case you have to split above string and manualy check if folder exists . or select a "near By" Folder...
           have i understood the question?
0
 
LVL 13

Accepted Solution

by:
joechina earned 2000 total points
ID: 17811954
Change
x.StartInfo.Arguments = "C:\\Program Files\\Application X\\Images";
To
x.StartInfo.Arguments = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).Substring(6) + "\\Images";


0
 
LVL 13

Expert Comment

by:joechina
ID: 17811960
You can remove the "+\\Images" if your assembly is installed under images directory.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question