I have vb app that calls another vb app using Process.Start(PROGRAM). My question is how can I pass a parameter to the PROGRAM and how can I intercept it in the PROGRAM?
+3
A:
You can add a second string with the command line parameters when you call Process Start.
proc = process.start(program, parameters)
To access the command line parameters in the called program, you can use a loop like this:
For Each s In My.Application.CommandLineArgs
xpda
2010-02-07 20:54:20
+1
A:
Use the ProcessStartInfo class and set the FileName property to the name of the VB app, then set the Arguments property to the arguments.Assign the property StartInfo of the Process class to the instance of ProcessStartInfo and you're good to go.
From the other VB application use Args parameter of the Main class which is of a string array to process the arguments.
Hope this helps, Best regards, Tom.
tommieb75
2010-02-07 20:55:54
>>>Arguments Property...What/where is this? from here on I'm lost
bochur1
2010-02-07 22:13:42
@bochur1: Arguments is a property of ProcessStartInfo class in which you instantiate. Dim ps As New ProcessStartInfo() ps.FileName = "name_of_exe" ps.Arguments = "exe_arguments" Dim proc As New Process() proc.StartInfo = ps proc.Start
tommieb75
2010-02-07 23:11:57