0

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?

2
  • msdn.microsoft.com/en-us/library/… Commented Feb 7, 2010 at 21:11
  • Usually you can open up the corresponding MSDN article very easily by placing the cursor into Start and then pressing F1. There you find samples how to use the Start method and information on what overloads are available. Commented Feb 7, 2010 at 21:14

2 Answers 2

3

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
Sign up to request clarification or add additional context in comments.

Comments

1

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.

2 Comments

>>>Arguments Property... What/where is this? from here on I'm lost
@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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.