Click to See Complete Forum and Search --> : Passing command-line options to VB programs.


tiffin_tom
May 10th, 2001, 10:07 AM
Hi, we are trying to write a Visual Basic program (version 6) and need some help with something that's probably really simple.

How do you pass command-line options in Win 9x (i.e., a path and file name) to a visual basic program? I know I'll shoot myself when I hear the answer.

Thanks.

LagMonster
May 10th, 2001, 10:26 AM
yes you will! LOL


x = command

Parse x as you wish

LagMonster
May 10th, 2001, 10:27 AM
Easy VB APP for ya.

Create a text box!

On form_load

text1.text=command

Thats all..you can see what passes through then.

tiffin_tom
May 10th, 2001, 10:50 AM
Thanks bunches for the quick and accurate reply! :)

Bang!
(That's the sound of the gun going off)

hehehe

antonye
May 10th, 2001, 03:16 PM
Tip: Use the Command internal variable in conjunction with the InStr function to see which parameters have been passed.

For example, if you want to see if an auto-run switch, such as -run, has been passed, then you can do something like:


if InStr(LCase(Command), "-run") then
Call RunMyFunction
end if