Solved

Explorer Issue

Posted on 2006-10-25
3
162 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
  • 2
3 Comments
 
LVL 21

Expert Comment

by:theGhost_k8
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 500 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now