Simple Visual Basic Question

TiziteLayinLow

Senior member
Aug 18, 2003
493
0
0
i want to be able to run like "project1.exe -15".. just run the exe with a parameter like in DOS can this be accomplished in VB and if so how? ive never tried this before so i dont know how to do it..

any help is appreciated
 

Ichinisan

Lifer
Oct 9, 2002
28,298
1,235
136
Originally posted by: TiziteLayinLow
...elaborate? (sp?)
Assuming that you are using VB6; MsgBox Command$ will show you the entire command that launched the current running process. It is a string, so you'll have to use standard string functions to seperate the parameters and parse them individually. I recommend using chr(32) (space), "/", and "-" as delimiters for command switches. That "$" is a remnant of ancient BASIC compilers which required such names to identify string variables.
 

AtTheGates

Senior member
Jun 11, 2003
274
0
0
Here a quick example based on the project1.exe -15 you listed. This assumes that the argument after the app name is a number that needs to have some operation preformed on it. Example turns the string argument into an Integer and the multiplies by 10.