Groups | Blog | Home
all groups > vb.net > september 2007 >

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


kimiraikkonen
9/30/2007 3:19:30 PM
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.
Family Tree Mike
9/30/2007 5:35:01 PM
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.

[quoted text, click to view]
Family Tree Mike
9/30/2007 6:10:00 PM
Andrew is correct, that there should be a + " " + between the two textbox
items.


[quoted text, click to view]
Andrew Jackson
9/30/2007 8:41:12 PM
Looks to me you forgot one of your str concats

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

[quoted text, click to view]

Andrew Jackson
9/30/2007 8:42:35 PM
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)

[quoted text, click to view]

rowe_newsgroups
10/1/2007 3:26:01 AM
On Sep 30, 9:10 pm, Family Tree Mike
[quoted text, click to view]

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
kimiraikkonen
10/1/2007 11:13:26 AM
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")
AddThis Social Bookmark Button