Hi

I am trying to open other programs in a PDA using C# Compact Framework. Would anyone be able to advise me on how it would be possible to go about this. This programs all exist external of my program but they are meant to be open throught the one interface. I have the path names but I am not sure of the code to open an application. Any guideance on this would be greatly appreciated.

Thanks in advance

Greetings:
You could use a process for this:

Process p=new Process();
p.StartInfo.FileName=file;
p.StartInfo.WindowStyle=ProcessWindowStyle.Hidden;
p.Start();p.WaitForExit();p.Close();

Just make sure youre using System.Diagnostics

Greetings:
You could use a process for this:

Process p=new Process();
p.StartInfo.FileName=file;
p.StartInfo.WindowStyle=ProcessWindowStyle.Hidden;
p.Start();p.WaitForExit();p.Close();

Just make sure youre using System.Diagnostics

Hi sorry but would be able to explain this to me in more detail. I am new to programming and I dont understand was this is to do. This is probably a simply process but i am unaware where there is a place which i place the name of the program i want opened.

This code is to be run when a button is clicked. Would anyone be able to assist me on this

Thanks

Paste that code above in your button click event.
In the second line - p.StartInfo.FileName=file;

replace the word "file" on the right of the equals with the name of your program you want to start such as 'notepad.exe' and it will do the rest. make sure it is a string and a fully qualified name so the system can find the file.

So it would look somthing like this.

Process p=new Process();//Declare new process
p.StartInfo.FileName="notepad.exe";//Tell it to open notepad
p.StartInfo.WindowStyle=ProcessWindowStyle.Normal; //Show notepad
p.Start();p.WaitForExit();p.Close();//Start it, and then kill it when program (notepad) closes

You also need this in the 'using' sectino at the top

using System.Diagnostics;

And to get into the button click event, just double click on the button on your designer.

-T

This article has been dead for over six months. Start a new discussion instead.