how do I pass external parameters to a vb exec - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

how do I pass external parameters to a vb exec

pdr1165pdr1165 Posts: 3Member
I want to pass two external parameters to my vb exec to be used as variables so I can reuse the same exec.

The two parameters are the SQL table name and the report name.

I want to create a shortcut on the user's desktop that the command line is as follows:

IconMain.exe _SQLtablename_ _ReportFileName_

I'm using Sub Main() as my start since execution should be transparent to the user.

I also have a Sub Process_Workfile() which I want to pass both parameters to.

Can someone give me a code snippet example of how to do this?

Thanks

Comments

  • paulj59paulj59 Posts: 420Member
    : I want to pass two external parameters to my vb exec to be used as variables so I can reuse the same exec.
    :
    : The two parameters are the SQL table name and the report name.
    :
    : I want to create a shortcut on the user's desktop that the command line is as follows:
    :
    : IconMain.exe _SQLtablename_ _ReportFileName_
    :
    : I'm using Sub Main() as my start since execution should be transparent to the user.
    :
    : I also have a Sub Process_Workfile() which I want to pass both parameters to.
    :
    : Can someone give me a code snippet example of how to do this?
    :
    : Thanks
    :
    Command$ contains the entire command line.
    l=Instr(Command$," ") to find the space,
    then SQLtablename=left$(command$,l-1) and ReportFileName=mid$(command$,l+1)
  • pdr1165pdr1165 Posts: 3Member
    [b][red]This message was edited by pdr1165 at 2002-10-17 11:3:59[/red][/b][hr]
    : Command$ contains the entire command line.
    : l=Instr(Command$," ") to find the space,
    : then SQLtablename=left$(command$,l-1) and ReportFileName=mid$(command$,l+1)
    :

    Do I put this code right under Sub Main() or elsewhere?

    This is what I have.

    Sub Main()
    Dim l As String
    Dim SQLtablename As String
    Dim ReportFileName As String

    l = InStr(Command$, " ")
    SQLtablename = Left$(Command$, l - 1)
    ReportFileName = Mid$(Command$, l + 1)
  • pdr1165pdr1165 Posts: 3Member
    Thanks, figured it out. Works perfectly!
  • kai97kai97 Posts: 1Member
    : Thanks, figured it out. Works perfectly!
    :

    Hi pal,

    Ive tried your code... but it doesn't give me any output at all.
    Kindly help to explain what is the mistake i made.
    My codes are as below:

    Public Class Form1

    Public Sub main()
    Dim l As String

    l = InStr(Command$, " ")

    lblOutput01.Text = l

    End Sub

    End Class

    I run the program like this:
    program.exe abc

    but i only get a blank form.
    Please help.

    Thank you.

    Regards,
    kai97
  • vibin_mdcpvibin_mdcp Posts: 60Member
    : : Thanks, figured it out. Works perfectly!
    : :
    :
    : Hi pal,
    :
    : Ive tried your code... but it doesn't give me any output at all.
    : Kindly help to explain what is the mistake i made.
    : My codes are as below:
    : [code]
    : Public Class Form1
    :
    : Public Sub main()
    : Dim l As String
    :
    : l = InStr(Command$, " ")
    :
    : lblOutput01.Text = l
    :
    : End Sub
    :
    : End Class
    : [/code]
    : I run the program like this:
    : program.exe abc
    :
    : but i only get a blank form.
    : Please help.
    :
    : Thank you.
    :
    : Regards,
    : kai97
    :

    Problem is at the statement
    l = InStr(Command$,"")

    Here no need to use InStr. Only
    l = Command$
    is enough.

    InStr function compares two strings and return either 1 or 0.
Sign In or Register to comment.