473,387 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Run Command from a Windows Form

I have what I believe is probably a simple question...

Is there any programatic way to launch a program similar to the Start->Run
Command.

I am have a link in a ListView for "Open Containing Folder", I want to open
the page using windows explorer is there a way to Run("explorer.exe
c:\folder\")?

Also, Is there anyway to focus on an existing window if one is already
created.
Feb 7 '06 #1
2 4494
Ben,

I don't know about focusing on the existing window. For that, you
might have to cycle through the open windows, and maybe query the text of
the windows.

However, in order to open a the containing folder, you would want to use
the Process class, and then pass the name of the directory as the process to
execute. You have to also set UseShellExecute on the ProcessStartInfo
instance to true, I believe.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ben Dewey" <As*********@hotmail.com> wrote in message
news:eH*************@TK2MSFTNGP10.phx.gbl...
I have what I believe is probably a simple question...

Is there any programatic way to launch a program similar to the Start->Run
Command.

I am have a link in a ListView for "Open Containing Folder", I want to
open the page using windows explorer is there a way to Run("explorer.exe
c:\folder\")?

Also, Is there anyway to focus on an existing window if one is already
created.

Feb 7 '06 #2
> I have what I believe is probably a simple question...

Is there any programatic way to launch a program similar to the
Start->Run Command.

I am have a link in a ListView for "Open Containing Folder", I want to
open the page using windows explorer is there a way to
Run("explorer.exe c:\folder\")?

Also, Is there anyway to focus on an existing window if one is
already created.


Don't know about focusing. I doubt that it's built into the framework though.

To start a process have a look at System.Diagnostics.Process.Start
Feb 7 '06 #3

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

Similar topics

7
by: Steve M | last post by:
I'm trying to invoke a Java command-line program from my Python program on Windows XP. I cannot get the paths in one of the arguments to work right. The instructions for the program describe the...
5
by: Jarod | last post by:
Hey I have already written a program that has a user interface, but I would like to add some command line interface too. So if the user run it like: program.exe paramater1 The program do...
4
by: Francesco Martinelli | last post by:
I need to create a multiple file assemby: this requires working directly with the command line compiler (no IDE support!). After a few tests I found my problem comes from the issue described below....
4
by: Primo | last post by:
Hi, This problem has been frustrating me for days and I hope you experts can help me out. I am trying to run a command, which I would normally run from the command line, from within my C#...
0
by: January Smith | last post by:
When I run the code below after creating an Empty .Net type project and adding an Empty C++ file it always opens a command window before displaying the form. If I write a similar VB application by...
3
by: Tim | last post by:
Hi, I am trying to pass a SQL Command, complete with parameters and their values from one form to a modal form. The modal form has; public void...
14
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons...
3
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however,...
7
by: Jwe | last post by:
Hi, I've written a program which has both a command line interface and Windows form interface, however it isn't quite working correctly. When run from command line with no arguments it should...
3
by: Tomas Andersson | last post by:
So here is my problem I have a program written in VB9 that I wanted to add a file reference to textfile renamed .spf. In the file there is stuff on every row that the program does something about....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.