Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General 2 / September 2005



Tip: Looking for answers? Try searching our database.

Sub Main() arguments?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
The Mighty Menace - 26 Sep 2005 23:08 GMT
Is it possible to pass arguments to Sub Main() in a VB program?

Rather than writing two nearly identical programs in VB, I want to write
only one whose passed argument (from the command line) tells the program
which of two paths of execution to take.

Dennis C. Fait
Mosherville, Michigan
Rick Rothstein [MVP - Visual Basic] - 27 Sep 2005 00:57 GMT
> Is it possible to pass arguments to Sub Main() in a VB program?
>
> Rather than writing two nearly identical programs in VB, I want to write
> only one whose passed argument (from the command line) tells the program
> which of two paths of execution to take.

VB supplies a function that will allow you to do what you want.
The function is named Command (look it up in the help files) and
if it empty (that is, "") then no command line argument was
passed. If it is not empty, then the Command function will return
the contents of the command line and you can parse it as needed.

Rick
The Mighty Menace - 27 Sep 2005 16:31 GMT
Rick,
 Thanks for the info. But after I posted this request I did what I should
have done right after searching VB6's help database. That is, do a search on
the Web.

 There I found a piece of code that works great at
http://www.devx.com/getHelpOn/10MinuteSolution/20366

 Again, thanks.
Dennis

> > Is it possible to pass arguments to Sub Main() in a VB program?
> >
[quoted text clipped - 11 lines]
>
> Rick
HKSHK - 29 Sep 2005 15:25 GMT
Hello Dennis,

use the "Command" function.

Best Regards,

HKSHK

> Is it possible to pass arguments to Sub Main() in a VB program?
>
[quoted text clipped - 4 lines]
> Dennis C. Fait
> Mosherville, Michigan
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.