Geekpedia Forums Logo

Listbox and external exe

by Justin Mills on Monday, March 10th - 6:59 PM



Hi

i am trying to create an app in c# thats a gui for a dos program.

i am a noob when it comes to programming & explaining stuff so please bear with me.

basic overview of the app is you drag and drop certain files into a list box select a few options then hit a button to lauch the external app.

running from cmd prompt you would type somthing like myapp -outputfile -option -inputfiles(upto 32 max)

so myapp.exe c:\output.img bootable c:\item1.img c:\item2.img c:\item3.img c:\item4.img

i could do it by asking the user to choose how many files the get them to browse for them using file open dialogue and storing each one in a hidden text box but this is very poor coding and leaves room for lots of errors(i have working code for this).

my drag and drop code works fine i can start the app i just cant work out how to pass the list box info to my program arguments

this is my code

 

{

 

e.Effect =

}

 

{

 

 

{

listBox1.Items.Add(file);

}

}

 

{

System.Diagnostics.

runApp.EnableRaisingEvents =

runApp.StartInfo.FileName =

private void listBox1_DragEnter(object sender, DragEventArgs e)if (e.Data.GetDataPresent(DataFormats.FileDrop, false) == true)DragDropEffects.All;private void listBox1_DragDrop(object sender, DragEventArgs e)string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);foreach (string file in files)private void button1_Click(object sender, EventArgs e)Process runApp = new System.Diagnostics.Process();false;"c:/myapp.exe";

// runApp.StartInfo.Arguments = String.Format("{0} (1) (2)", textBox1.text , comboBox1.text , Listbox Items Stuck Here !! );

runApp.Start();

runApp.WaitForExit();

}

the bit i need help with is the startinfo.arguments part the 3rd option listbox items there maybe 1 or upto say15

i dont know the correct terminoligy to to search for what i want to do but i want to take all the items in the list box a pass them in the 3rd argument with spaces in between(may need to be seperated by quotes aswell)

 

 

Regards

 

Justin

did not know that my code would get messed up but lits this part im stuck on

runApp.StartInfo.Arguments = String.Format("{0} (1) (2)", textBox1.text , comboBox1.text , Listbox Items Stuck Here !! );