Muti-parameter for System.diagnostics.process.start() ???

K

kimiraikkonen

Hello,
I want to ask this:

If i do: System.Diagnostics.Process.Start("c:\lame", "--preset
standard c:\blabla.wav c:\blabla.mp3") it works.

But i don't want this. I want my 2 textboxes must take place as
variable like: System.Diagnostics.Process.Start("c:\lame", "--preset
standard textbox1" textbox1.text +
textbox2.text). But that doesn't work. Meanwhile textboxes are the
filename paths.

How can i run my process with more than one parameter using user
variables like placed in textboxes?

Very thanks.
 
G

Guest

This should work:

System.Diagnostics.Process.Start("c:\lame", _
"--preset standard textbox1" + textbox1.text + textbox2.text).

You were missing one plus sign. If you copied wrong and actually had the
plus sign, then it should have worked. You may need to quote some of the
strings, if they contain spaces. Spaces are assumed to separate the
arguments, so quoting it will allow for a space in an argument.

Hope this helps.
 
A

Andrew Jackson

Looks to me you forgot one of your str concats

System.Diagnostics.Process.Start("c:\lame","--preset
standard"+textbox1.text+" "+textbox2.text)
 
A

Andrew Jackson

Mybad you also probably need to put a space after standard in my reply
below.

System.Diagnostics.Process.Start("c:\lame","--preset standard
"+textbox1.text+" "+textbox2.text)
 
R

rowe_newsgroups

Andrew is correct, that there should be a + " " + between the two textbox
items.

For hard to read concatenations, I tend to use the String.Format()
option:

Process.Start("C:\lame", _
String.Format("--preset standard {0} {1}", textBox1.Text,
textBox2.Text))

(imo) It makes spacing and other concerns much easier to look at.

Thanks,

Seth Rowe
 
K

kimiraikkonen

Thanks all :) Multi-parameter launch is OK now but i couldn't hide my
process while processing. It's still shown on the screen.

Dim myProcess As System.Diagnostics.Process = New
System.Diagnostics.Process()
myProcess.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Hidden
myProcess = System.Diagnostics.Process.Start("c:\lame",
"--preset standard" + textbox1.text + " " +
textbox2.text).
myProcess.WaitForExit()
MsgBox("Conversion Completed Successfully",
MsgBoxStyle.Information, "Completed")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top