1

I have created a form which will run a .exe file say test.exe and take the input from a textbox. The code I have written

System.Diagnostics.Process.Start("E:\My_programme\test\test.exe", TextBox1.Text)

This works fine

Now I need another program to run which takes 2 inputs from 2 different textbox. The code I have written

System.Diagnostics.Process.Start("E:\My_programme\test\test.exe", TextBox1.Text, TextBox2.Text)

Its showing Error 1 Overload resolution failed because no accessible 'Start' accepts this number of arguments

The normal procedure to run the test.exe from command prompt is

E:\My_programme\test\test.exe", A, B

where A and B are two parameters to be given in the two textbox.

I am very new to Visual Basic, so anybody please help me to solve my problem.

1

2 Answers 2

1

The System.Diagnostics.Process.Start() method only accepts a String defining the path to the .exe and a second String defining the parameters. Try:

Dim parameters as String
parameters = String.Format("{0} {1}", TextBox1.Text, TextBox2.Text)
System.Diagnostics.Process.Start("E:\My_programme\test\test.exe", parameters)

This will create one string out of the two TextBoxes and forward it to the test.exe as input.

Sign up to request clarification or add additional context in comments.

Comments

1

Put your arguments in StartInfo.Arguments

  Dim p As New System.Diagnostics.Process
  p.StartInfo.FileName = "E:\My_programme\test\test.exe"
  p.StartInfo.Arguments = TextBox1.Text &" "& TextBox2.Text
  p.Start()

Comments

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.