Hi,<br>
<br>
I am trying to create an EXE in VB to which one is able to pass a number of arguments. I tried to enter the variable list into the sub main procedure but VB doesn't except it. Does anybody has a solution of this?.<br>
<br>
Thanks in advance
use the "Command" word<br>
<br>
in the Load event of your VB app<br>
check what it is<br>
here is a sub I use for that purpose.<br>
--------------------<br>
'put his in your Form_load<br>
Get_Comd_Lin<br>
<br>
Public Sub Get_Comd_Lin()<br>
Comd = Command<br>
If Comd = "" Then ' If no command line.<br>
Msg = "There is currently no command-line string." & Chr$(10)<br>
Msg = Msg & "Must type in /E 140 /S 2 at least to make Run" & Chr$(10)<br>
Msg = Msg & "E=Your Extension S=Your Serial Port"<br>
Style = 0 'display OK button<br>
Title = "NO Command Line option" ' Define title.<br>
Response = MsgBox(Msg, Style, Title)<br>
NoComdLine = True<br>
MousePointer = 0<br>
Exit Sub<br>
Else ' Put command line into message.<br>
Msg = "'" & Comd & "'"<br>
End If<br>
For a = 1 To Len(Comd)<br>
Got_Sl = InStr(a, Comd, "/"<br>
Got_A_Switch = Mid$(Comd, a + 1, 1)<br>
Debug.Print a, Got_A_Switch<br>
If UCase$(Got_A_Switch) = "S" Then<br>
SerialPort = Val(Mid(Comd, a + 3, 1))<br>
a = a + 4<br>
ElseIf UCase$(Got_A_Switch) = "T" Then<br>
TimerVal = Mid(Comd, a + 2, 6)<br>
Debug.Print TimerVal<br>
Exit For<br>
End If<br>
<br>
Next<br>
<br>
End Sub<br>
---------------------<br>
you can pass several parameters and parse them out.<br>
I use the Pipe symbol "¦" to separate parameters now but in this sub I used the slash "/".<br>
<br>
Hope this Helps<br>
<br>
<br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.