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
:
: 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)
: 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)
:
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
: :
:
: 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.