John Wilson

John Wilson

  • NA
  • 1
  • 3.7k

How do I use VB.NET to pass square brackets to a command line string?

Dec 10 2010 5:38 PM



This works Great:
    System.Diagnostics.Process.Start("C:\Program Files\Easy View 3\EasyView.exe", String.Format("CMD R=U:\Reports\WO_Start_I.rpt,M=Q,SV={0},DB={1},UN={2},PW={3},P[WONO]=[129005]", SV, DB, UN, PW))
"SV" is the server name, DB is the database, etc.
 
Each has this code:`
    Dim SV As String`
    SetValue("SV") = "ServerName"
, etc.

When CheckBox is clicked in the Screen, Work Order Number 129005 prints as expected!

This and all iterations I've tried doesn't:

    System.Diagnostics.Process.Start("C:\Program Files\Easy View 3\EasyView.exe", String.Format("CMD R=U:\Reports\WO_Start_I.rpt,M=Q,SV={0},DB={1},UN={2},PW={3},P[WONO]=[{4}]", SV, DB, UN, PW, CWONO))

Replacing the "129005" with the database field data declared as CWONO

When CheckBox is clicked with this code, the Work Order prints, but without any data.

I even tried to declare the Left and Right Brackets:
   
    Dim LB As String
    Dim RB As String
    SetValue("RB") = "]"
    SetValue("LB") = "["

Then this:
    System.Diagnostics.Process.Start("C:\Program Files\Easy View 3\EasyView.exe", String.Format("CMD R=U:\Reports\WO_Start_I.rpt,M=Q,SV={0},DB={1},UN={2},PW={3},P[WONO]={4}{5}{6}]", SV, DB, UN, PW, LB, CWONO, RB))

Only to get an Error titled: `"cleCommandLine:Get_Command_Line_Settings" and that read,
"conversion from string "" to type 'Boolean' is not valid."`

And then an error with the program being executed that there was something wrong with a Parameter.
Thanks!

Answers (1)