VB.Net 2008 Process Class "valid expression continuation expected" Error

I need help resolving a VB.Net 2008 "valid expression continuation expected" error.

I am trying to use the Process class to execute the following code:
"C:\Program Files (x86)\Visual CUT 11\Visual CUT.exe" -e "C:\test\Ingredients_Freezer2.rpt" "Export_Format:Adobe Acrobat (pdf)" "Export_File:C:\test\Ingredients_Freezer2.pdf"

The following code executes without an error:
'Dim VC_1 As Process = System.Diagnostics.Process.Start("C:\Program Files (x86)\Visual CUT 11\Visual CUT.exe")

However, the following code does not run and returns an error:
        Dim VC_1 As Process = System.Diagnostics.Process.Start("C:\Program Files (x86)\Visual CUT 11\Visual CUT.exe" -e "C:\test\Ingredients_Freezer2.rpt" "Export_Format:Adobe Acrobat (pdf)" "Export_File:C:\test\Ingredients_Freezer2.pdf")

Error:
Comma, ')', or a valid expression continuation expected.


I am using the following information as an example of how to call Visual CUT from a Visual Basic application. The sample code is from p. 80 of Visual Cut manual for Version 6.8002, March 2015.

Here's a code example of calling Visual CUT from a Visual Basic application and specifying a parameter value. Note that double quotes are "escaped" by using "" instead of ".

Code:
Dim ls_temp As String ls_temp = "c:\Program Files\Visual CUT 9\Visual CUT.exe " & _
"-e ""c:\temp\Sales.rpt"" ""Parm1:2005"""

RetVal = Shell(ls_temp)
Mark01Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

it_saigeDeveloperCommented:
Double quotes are used as an escape character in VB.NET, this means you have to double up on them when you want them used as a part of the string that is output.

Try:
System.Diagnostics.Process.Start("C:\Program Files (x86)\Visual CUT 11\Visual CUT.exe -e ""C:\test\Ingredients_Freezer2.rpt"" ""Export_Format:Adobe Acrobat (pdf)"" ""Export_File:C:\test\Ingredients_Freezer2.pdf""")

Open in new window

If that doesn't work then you will probably also want to use the Process.Start overload that takes the command as one parameter and the arguments as another:
System.Diagnostics.Process.Start("C:\Program Files (x86)\Visual CUT 11\Visual CUT.exe", "-e ""C:\test\Ingredients_Freezer2.rpt"" ""Export_Format:Adobe Acrobat (pdf)"" ""Export_File:C:\test\Ingredients_Freezer2.pdf""")

Open in new window


-saige-
0
Mark01Author Commented:
it_saige, I tried both of your solutions but I get several errors. The first error that both of them generate is “character constant must contain exactly one character.” The attached screen shots show the other errors.
Code1.pdf
Code2.pdf
0
it_saigeDeveloperCommented:
Could you post your exact code?  When I use the code I posted, I get the command and arguments identified property.

Try implementing a test project with just the following.
Module Module1
	Sub Main()
		Dim psi As ProcessStartInfo = New ProcessStartInfo("C:\Program Files (x86)\Visual CUT 11\Visual CUT.exe", "-e ""C:\test\Ingredients_Freezer2.rpt"" ""Export_Format:Adobe Acrobat (pdf)"" ""Export_File:C:\test\Ingredients_Freezer2.pdf""")
		Using [process] As Process = New Process()
			[process].StartInfo = psi
			[process].Start()
		End Using
	End Sub
End Module

Open in new window

I am able to verify the correct parameter placement -Capture.JPG-saige-
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mark01Author Commented:
Your code worked! Thank you, it_saige.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.