Question : How do I pass command line values to a VB .exe

Firstly let me state I am very very new to VB, I downloaded VB Express 2010 yesterday, so genuinely please feel free to answer this question as if you were explaining it to a toddler.

Basically what I have is a piece of code amended from an example given to me by a software supplier. It is used to call their API. This code works fine to open up a specific matter, matter number 00000008/0000032, within their system.

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
Module Module1
    '1. Make sure that "VFileComAPI.exe" has been referenced in the project
    '2. Create an instance of the API
    Dim Visualfiles As New VisualfilesComAPI.Connection
    Sub Main()
       

        Dim L_RESULT As String
        Dim L_APICALL As String

        L_APICALL = Visualfiles.Connect("SolcaseTest")
        L_RESULT = Visualfiles.OpenCase("00000008/0000032", "")
        L_APICALL = Visualfiles.Disconnect(False, "")
        Visualfiles = Nothing
    End Sub
End Module


What I am looking for is to make this code more generic so that I can pass the Visualfiles.OpenCase a string which will be a specific Matter Number. Having done a bit of googling it looks like I can do this in a command line?

What I'm also looking for is the best way to email something, whether a .bat file, hyperlink or by some other method, to a user so that when they run it from their email it runs the code with the value (matter number) passed to it and then opens up that specific matter.

I hope this explains clearly enough what I am looking for but if not please just let me know.

Thanks

Answer : How do I pass command line values to a VB .exe

Try the code below then use it like this:

Call the exe like this

YourApplication "00000008/0000032" , "SoleCaseTest"
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
Module Module1
    '1. Make sure that "VFileComAPI.exe" has been referenced in the project
    '2. Create an instance of the API
    Dim Visualfiles As New VisualfilesComAPI.Connection
    Sub Main()
       
        Dim args as string() = command.Split(",")
        Dim OpenCaseValue as string = args(1) 
        Dim ConnectTo as string = args(0)

        Dim L_RESULT As String
        Dim L_APICALL As String

        L_APICALL = Visualfiles.Connect(ConnectTo)
        L_RESULT = Visualfiles.OpenCase(OpenCaseValue, "")
        L_APICALL = Visualfiles.Disconnect(False, "")
        Visualfiles = Nothing
    End Sub
End Module
Random Solutions  
 
programming4us programming4us